cfg4j / cfg4j

Modern configuration library for distributed apps written in Java.

Home Page:http://cfg4j.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do we get Property File and it's property values using cfg4j library

bpkumar74 opened this issue · comments

Hi,
We are trying to use cfg4j for multiple property files from the Git repository. Right now, we are loading GitSourceBuilder for each properties and able to get all properties from that file into Properties object.

We understand that we can pass multiple file names to GitSourceBuilder, but it is merging all properties from multiple files into one Properties Object. We have common code that reference to same element, where some property files may not have that property vs others may have. If all are loaded together, our application will not work properly. We would like to get properties with property file name, such that we can use correctly.

Example:
propertyfile1.properties
mq.expire=true
mq.server=host2
mq.port=123

propertyfile2.properties
mq.server=host
mq.port=234

If we load these 2 properties, then we need to change each common code and property files to contain module name, which makes it difficult. If cfg4j can give as below:

Map
propertyfile1.properties (String), Properties (mq.expire-true, mq.server=host2,......)
propertyfile2.properties (String), Properties (mq.server=host,......)

Can this be done using cfg4j for git?

Thanks
Praveen