Conf4j - Type-safe Configuration Library for Java

Build Status Maven Central

conf4j is a library which allows accessing configuration data in object-oriented, type-safe manner.

In conf4j configuration is represented as an interface or abstract class optionally annotated with conf4j annotations.

public interface ConnectionConfiguration {
   String getUrl();

   String getUser();

   String getPassword();

   int getConnectionTimeout();

   int getReadTimeout();

Then a configuration instance is created and bound to the value source by the configuration factory.

ConfigurationSource source = new PropertiesConfigurationSource("");
ConfigurationFactory factory = new JdkProxyStaticConfigurationFactory();
ConnectionConfiguration configuration = factory.createConfiguration(ConnectionConfiguration.class, source);

Once the configuration instance is created you can access the configuration values via getters:

String url =  configuration.getUrl();
int connectionTimeout = configuration.getConnectionTimeout();

Example is as follows:


For more information how to use conf4j please read Conf4j User's Guide and check conf4j-examples directory.


We accept pull request via GitHub. Here are some guidelines which will make applying PRs easier for us:

See CONTRIBUTING document for more details.


Copyright 2017-2018 Sabre GLBL Inc.

Code is under the MIT license.