读书人

Apache Commons Configuration的运用

发布时间: 2012-10-16 09:57:37 作者: rapoo

Apache Commons Configuration的应用

http://lavasoft.blog.51cto.com/62575/101242

?

Apache Commons Configuration的应用
Commons Configuration是一个java应用程序的配置管理工具。可以从properties或者xml文件中加载软件的配置信息,用来构建支撑软件运行的基础环境。在一些配置文件较多较的复杂的情况下,使用该配置工具比较可以简化配置文件的解析和管理。也提高了开发效率和软件的可维护性。
官方主页:[url]http://commons.apache.org/configuration/[/url]
一、介绍
官方列举Commons Configuration的主要功能:
Configuration parameters may be loaded from the following sources:
Properties files?
XML documents?
Windows INI files?
Property list files (plist)?
JNDI?
JDBC Datasource?
System properties?
Applet parameters?
Servlet parameters
Commons Configuration所依赖的包?+ password);?

????????}?
}?cfgtest/test1.propertiesusername = lavasoft?
password = leizhimin?
?运行结果:lavasoft leizhimin?

Process finished with exit code 0
?从上面看出,使用Apache Commons Configuration来读取配置确实很简单,还可以省很多事情。它不光可以读取properties文件,还可以读取xml,还可以读取xml和properties混合文件等等。

读书人网 >Apache

热点推荐