读取应用程序配置的Java类库 EasyConf

openkk 12年前

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.open-open.com/lib/view/home/1329288511015