PrefixedProperties can filter properties by an environment and use Fallbacks. But what if you have properties that are request depended. Lets say you have a webservice and you want to have different behaviors per user. With PrefixedProperties you have the possibility to change the prefix configuration per request. Instead of using the setDefaultPrefix Method use the setConfiguredPrefix which has the same functionality like the other method but only works for the current Thread. Configurations of other Threads would be unchanged.
//GenderPrefixConfig contains Male with prefix m and Female with prefix f static final PrefixedProperties props = PrefixedProperties.createCascadingPrefixProperties(new StagingPrefixConfig(), new GenderPrefixConfig()); ... props.setDefaultPrefix("test");//sets the default property for the StagingEnvironment to test props.setProperty("key1", "value1"); props.setProperty("test.key2", "testvalue2"); props.setProperty("test.f.key2", "female test value2"); props.setProperty("test.m.key2", "male test value2"); //one Threads might call props.setConfiguredPrefix(GenderPrefixConfig.MALE); props.get("key2"); //will return 'male test value2' //another Thread might call props.setConfiguredPrefix(GenderPrefixConfig.FEMALE); props.get("key2"); //will return 'female test value2'