Class ConfigurationLoader

  • public class ConfigurationLoader
    extends Object
    Provides a type-safe access to the configuration of the application.

    Often web applications need to load configuration from outside. T

    Typical usage would be MyConfig config=ConfigurationLoad.from(...).as(MyConfig.class) where the MyConfig interface defines a bunch of methods named after the property name:

     interface MyConfig {
         File rootDir();
         int retryCount();
         String domainName();

    Method calls translate to respective property lookup. For example, config.rootDir() would be equivalent to new File(properties.get("rootDir")).

    The method name can include common prefixes, such as "get", "is", and "has", and those portions will be excluded from the property name. Thus the rootDir() could have been named getRootDir().

    Kohsuke Kawaguchi