commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <>
Subject Prefix for combined configuration
Date Sat, 09 Apr 2016 04:07:35 GMT

I am trying to load multiple sources into a CombinedConfiguration
object. However, I need to access each property using a prefix.
For example, a property that resides in "global.xml" needs to be
accessed with a unique prefix:

And a property that is loaded from "", needs to be
accessed with the prefix:

I can extend CombinedConfiguration and override the getters, or create
a map. But if it's possible out of the box, it will save me sometime.
So here's my sample code:

        Parameters params = new Parameters();

        URL url =
        URL url2 =

        FileBasedConfigurationBuilder<XMLConfiguration> globBuilder =
new FileBasedConfigurationBuilder<XMLConfiguration>(XMLConfiguration.class);
        globBuilder = globBuilder.configure(params.xml().setURL(url));

testBuilder = new

        CombinedConfiguration cc = new CombinedConfiguration();

        // cc.setExpressionEngine(new XPathExpressionEngine());

        cc.addConfiguration(globBuilder.getConfiguration(), null, "global:");
        cc.addConfiguration(testBuilder.getConfiguration(), null, "case:");

        config = ConfigurationUtils.unmodifiableConfiguration(cc);

This is working great so far, as I can do:

Please note the dot in the dotted notation, between the prefix and the
property name. It will be nice if I there is an easy way to remove it,
so that I can do "".

Any advice ?

Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message