讀取應用程序配置的Java類庫 EasyConf

openkk 12年前發布 | 15K 次閱讀 Java 常用工具包

EasyConf是一個用來讀取應用程序配置的類庫。EasyConf的設計目標是使得編寫讀取應用配置更簡單。它的關鍵特性:

  1. Support for XML files, typed property files (including lists, numbers, classes, etc), or a combination of both
  2. Support for multiple environments (development, integration, preproduction, production, etc)
  3. Support for applications which aggregate several components: for example for portlets and portals
  4. Support for ASP applications: each company/organization serviced by the Application Service Provider my have its own configuration (since v0.9)
  5. Provides access to the configuration using JMX (since v0.9)
  6. Well documented!
  7. Easy to remember conventions instead of configuration to simplify usage

示例代碼:

  public static final double EURO_TO_DOLLARS_RATIO = EasyConf.
     getConfiguration("calculator").getProperties().
     getDouble("euro-to-dollars");

  public double toDollars(double euros) {
     return euros/EURO_TO_DOLLARS_RATIO;
  }

項目主頁:http://www.baiduhome.net/lib/view/home/1329288511015

 本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!