读取应用程序配置的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 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!