读取应用程序配置的Java类库 EasyConf
openkk
13年前
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; }