7.5. Obtaining Commons Configuration

Problem

You need to use Commons Configuration to access configuration stored in properties files and XML documents.

Solution

Commons Configuration 1.0 is not yet released, but you may download a nightly build from http://cvs.apache.org/builds/jakarta-commons/nightly/commons-configuration/. As Commons Configuration approaches a 1.0 release, a full binary release may also be available. Once Commons Configuration is released, you should be able to download a JAR by following the steps outlined in Recipe 1.1 and downloading “Commons Configuration 1.0” instead of Commons Lang. The Commons Configuration archive contains a JAR file named commons-configuration-1.0-rc1.jar, which should be placed in your classpath.

Discussion

Commons Configuration is designed to provide access to application configuration in the form of properties files, XML documents, JNDI resources, or data from a JDBC Datasource. Commons Configuration also allows you to create a hierarchical or multileveled configuration allowing for default settings to be selectively overridden by local configuration. Commons Configuration also provides typed access to single- and multivalued configuration parameters.

See Also

For more information about the Commons Configuration project, see the Commons Configuration project page at http://jakarta.apache.org/commons/configuration.

Get Jakarta Commons Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.