The configuration component allows an application to load up arbitrary configuration data that is backed by multiple datasources.

It is backed by Commons Configuration for accessing data and implements the Configuration API.

It is written for use in any container compatible with Avalon's Merlin or ECM container.


First, here is the role configuration.


Now comes the basic configuration of the component. Here we will configure the various configuration sources.

      <properties fileName="src/test/org/test.properties"/>
      <xml fileName="src/test/org/test.xml" optional="true"/>

The component supports the following sources of configuration which can be used as a list in arbitrary sequence. The order in that list is important. See the Commons Configuration Site for details on the configuration sources.

propertiesfileName="/path/to/file.properties" (req.)

optional="true" (opt.)
Load config from a Java Properties file. If optional is set to true, do not complain if the file is missing.
xmlfileName="/path/to/file.xml" (req.)

optional="true" (opt.)
Load config from a XML file. If optional is set to true, do not complain if the file is missing.
jndiprefix="java:comp/env" (req.)Load config from a JNDI context.
systemnoneLoad config from the System Properties
everything elsenoneAdd contents of this tag as a property to the configuration.

The old syntax with the attribute configurationPath="somepath" still works for reasons of backward compatibility.


The configurationPath is the location of the file read in by the ConfigurationFactory. This then returns your Configuration object.

To see an example, look at the test case ConfigTest.