Sometimes only a few properties need a specific configurations for an environment and maybe not all environments need a different one.
To have all values duplicated for every environment just to have one exception would be very annoying.
The clue is to use fallbacks which can be easily done be just skipping the prefixes.
properties-file:
dev.value=SPECIAL VALUE value=DEFAULT VALUE
usage with PrefixedProperties:
PrefixedProperties properties = new PrefixedProperties("dev"); properties.load("A_Properties_File.properties"); properties.get("value");//will return "SPECIAL VALUE" //switch the environment properties.setDefaultPrefix("liv"); properties.get("value");//will return "DEFAULT VALUE" //to get the value for the dev-environment while using another environment you can also use the full qualified key name. properties.get("dev.value");//will return "SPECIAL VALUE"