dr_85
dr_85

Reputation: 53

Exteding properties in a java project

I have a project with two properties files. Those are the config properties for different environments. As they are basically the same at the moment, I want to create a parent file property and extending it in the other ones. If I need a different value, I want to override it simply rewriting the property in the child file. Which maven plugin or library I need to do it ?

For instance:

Parent property file

key1=value1
key2=value2

Env1

key1=valuexxx 

Env2

key2=valueyyy

Upvotes: 0

Views: 39

Answers (1)

Igino Boffa
Igino Boffa

Reputation: 451

I think you don't need libraries...

You could do this way: assuming that you are putting every property in a Map, you firstly load properties from the "parent" property file, then, for every environment, you call the specific file.

By putting a new entry with an already present value into your Map, you're going to overwrite it

Upvotes: 1

Related Questions