讀取應用程序配置的Java類庫 EasyConf
EasyConf是一個用來讀取應用程序配置的類庫。EasyConf的設計目標是使得編寫讀取應用配置更簡單。它的關鍵特性:
- Support for XML files, typed property files (including lists, numbers, classes, etc), or a combination of both
- Support for multiple environments (development, integration, preproduction, production, etc)
- Support for applications which aggregate several components: for example for portlets and portals
- Support for ASP applications: each company/organization serviced by the Application Service Provider my have its own configuration (since v0.9)
- Provides access to the configuration using JMX (since v0.9)
- Well documented!
- 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; }
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!