I am using CompositeConfiguration to read properties from multiple sou开发者_如何学Crces (like .propeties files, xml files, System properties etc) as below.
ConfigurationFactory factory = new ConfigurationFactory("config.xml");
compConfig = (CompositeConfiguration)factory.getConfiguration();
compConfig.getProperty(propName);
Config.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<properties fileName="Properties1.properties"/>
<properties fileName="Properties2.properties"/>
<properties fileName="Properties3.properties"/>
<system/>
</configuration>
In addition to these files, I would like to read Preferences saved in Windows registry as well. I understand that java.util.Preferences API can be used to access values in Windows Registry. I was just wondering if there is a way to read them as well using PropertiesConfiguration?
Thanks
Looks like you would need to provide your own implementation of the AbstractConfiguration class. You could also use the JNDIConfiguration class if you're willing to pay for a JNDI provider for the windows registry
精彩评论