config-manager

Configuration manager to load and populate configurations from distinct formats and locations as system properties to config applications

This project is maintained by bytemechanics

Config Manager

Latest version Quality Gate Coverage License

Configuration manager to load and populate configurations from distinct formats and locations as system properties to config applications

Motivation

Loading conifurations is something booring that needs to be done in each application, in the past all java web applications should use JNDI or application server resources, but more and more applications are managed as standalone docker images running as a single application and JVM instance. The scenery has changed and we can go back to use system properties as reliable shared configuration between all application layers. But as been said times has changed and now properties files became too simple to manage current configurations, and for this reason is necessary some tool to load from distinct formats and overloading distinc configs.

Requirements

Java version: JDK8+

Currently supported formats

Currently supported schemes

Restrict

Quick start

(Please read our Javadoc for further information)

  1. First of all include the Jar file in your compile and execution classpath.
    • Maven
      <dependency>
            <groupId>org.bytemechanics</groupId>
            <artifactId>config-manager</artifactId>
            <version>X.X.X</version>
      </dependency>
      
    • Graddle
      dependencies {
          compile 'org.bytemechanics:config-manager:X.X.X'
      }
      
  2. Create the ConfigManager instance (keep in account that first configurations will be overrided if exist in the following files)
    ConfigManagerImpl instance = new ConfigManagerImpl("file://src/test/resources/integral-test-1.yml"
                                                        ,"classpath://integral-test.yml"
                                                        ,"classpath://org/bytemechanics/config/manager/internal/integral-test-2.yaml"
                                                        ,"classpath://integral-test-3.properties");    
    
  3. Load configuration, either
    • Directly to System.properties (classic behaviour)
      instance.load();
      
    • Manually (custom behaviour)
      instance.stream() //Stream<Config>
              .map(toMyObject::convert)
              (...)