Skip to content

Small library which allow you to load your application configuration

License

Notifications You must be signed in to change notification settings

kodokojo/property-configurer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kodo Kojo Logo


Kodo Kojo allows you to get a full out-of-the-box software factory.

This repository provide a small tool which allow us to configure our service and use those configuration in an smart and easy way. This little library is developed as a Java 9 module.

License

Kodo Kojo is licensed under GNU General Public License v3.

Stay tuned

Stay tuned by following us on:

Quickstart

Maven configuration

Add following dependency in your pom.xml :

<dependency>
    <groupId>io.kodokojo</groupId>
    <artifactId>property-configurer</artifactId>
    <version>0.2.0</version>
</dependency>

Use it

Create your Property configuration interface

Create an interface ApplicationConfiguration which will be used in your code :

interface ApplicationConfiguration extends PropertyConfig {
        @Key("elasticsearch.host")
        String elasticsearchHost();
        
        @Key(value = "elasticsearch.port", defaultValue = "9200")
        Integer elasticsearchPort();
}

In thos sample, we provide the value of method elasticsearchHost via the System Env elasticsearch_host. Create a PropertyResolver:

PropertyResolver resolver = new PropertyResolver(new SystemEnvValueProvider());
ApplicationConfiguration proxy = resolver.createProxy(ApplicationConfiguration.class);

And enjoy :

System.out.println("Elasticsearch host : " + proxy.elasticsearchHost());

Other property provider are available in this library, or you can provide yours implementing PropertyValueProvider interface.

Technology inside

We use the following tests tools:

Thanks to all those Open source projects which made such a project possible!

About

Small library which allow you to load your application configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages