Comparison of Commons Configuration With JFig and JConfig
以下内容是从mail-archives.eu.apache.org所找到的 [configuration] Comparison of Commons Configuration With JFig and JConfig "I have recently been looking at config tools and looked at Commons Configuration, JFig and JConfig. While JFig and JConfig appear to be quite similar, the Commons Configuration project seems a lot more flexible. Specifically I am keen on the ability to have my configuration details in different stores (property files, XML files, database or JNDI) at different stages of the development lifecycle i.e. I may start of with the config in a properties file for initial development but when moving across to testing and production I might start to use a database or LDAP server. This is a feature that neither of the other two packages has and is excellent. One feature that JFig has and Commons Configuration and JConfig appear to be missing (I am no expert in any of these packages so please correct me if I am wrong) is the ability to dynamically specify the configuration to use at runtime for example by setting a system parameter i.e. by using -Dconfig=test . This would allow different config files to be loaded dependent on the environment they are in i.e. development, test, uat or production. I have an updated version of the ConfigurationFactory class that has this feature if it is of interest to the project. The updated version allows the configuration to be retrieved using the code: Configuration config = ConfigurationFactory.getDynamicConfiguration(); I created a static method to minimise the number of lines of code to get the configuration and make it as simplistic as possible. This is similar to getting a Logger using Commons Logging. Then when I run my application or server I can optionally specify the "config" system property. If no "config" system property is set then the default config.xml file is loaded from the root of the classpath. Example config.xml
0 Comments:
Post a Comment
<< Home