Questions tagged [apache-commons-config]

The Commons Configuration software library provides a generic configuration interface which enables a Java application to read configuration data from a variety of sources.

The Apache Commons Configuration software library provides a generic configuration interface which enables a Java application to read configuration data from a variety of sources. Commons Configuration provides typed access to single, and multi-valued configuration parameters as demonstrated by the following code:

Double double = config.getDouble("number");
Integer integer = config.getInteger("number");

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

Different configuration sources can be mixed using a ConfigurationFactory and a CompositeConfiguration. Additional sources of configuration parameters can be created by using custom configuration objects. This customization can be achieved by extending AbstractConfiguration or AbstractFileConfiguration.

Official Website: http://commons.apache.org/configuration/

Useful Links:

146 questions
5
votes
2 answers

Using Apache Commons Configuration to do variable interpolation, i.e. ${variable}, with a list of values in a properties file

I am using Apache Commons Configuration to read a properties file, and I am perfectly able to do variable interpolation, and also to retrieve multi-valued properties as a list. However, I haven't been able to correctly load a property which has…
rodrigo.garcia
  • 557
  • 7
  • 11
5
votes
2 answers

Query empty XML elements with attributes using apache commons configuration xpath

I'm using the apache commons configuration XMLConfiguration object with the XPATH expression engine to query an XML file. I am new to xpath and apache commons and am having trouble with the syntax. The xml file looks like:
James DeRagon
  • 364
  • 1
  • 4
  • 11
5
votes
1 answer

Apache Commons Configuration: read from classpath/JAR?

Does the Apache Commons Configuration library support reading properties/configuration files from the classpath or JAR? I didn't find an API where it can take an InputStream, that returned by getResourceAsStream.
flow2k
  • 3,999
  • 40
  • 55
5
votes
2 answers

Combining configuration files

I'm developing a jee application which has to look at two files in order to load configuration parameters. Both files are properties-like files. The first one contains a default configuration properties and the other one overrides them. So the first…
Jordi
  • 20,868
  • 39
  • 149
  • 333
5
votes
3 answers

Apache Commons Configuration2 how to read data from InputStream

How can I read the data from InputStream by using Apache Commons Configuration2? FileBasedConfigurationBuilder builder = new FileBasedConfigurationBuilder(XMLConfiguration.class) .configure( …
Bruce
  • 647
  • 2
  • 12
  • 30
5
votes
1 answer

Gradle throws ClassNotFoundException using a plugin with dependencies

I am experiencing ClassNotFoundExceptions when using a Gradle plugin with compile dependencies in a project in the same root folder. The directory structure is rather simple, with a plugin and the project that will use…
frapontillo
  • 10,499
  • 11
  • 43
  • 54
5
votes
1 answer

Apache Commons Configuration validate properties file

I am using Apache Commons Configuration library with PropertiesConfiguration. My application loads the config file right after its started, like this: public PropertiesConfiguration loadConfigFile(File configFile) throws…
lenny
  • 2,978
  • 4
  • 23
  • 39
5
votes
3 answers

Netflix archaius cannot read updated property file value

I am a very much new to Netflix archaius. I have a code snippet which reads Java property file and prints property value. When this program runs it prints the value of property named "Fields" from testproperty.properties file. Now while this…
4
votes
1 answer

Detecting file reload in Apache Commons Configuration2

Using org.apache.commons:commons-configuration2:2.1 my application needs to know when a configuration file has been reloaded so that it can update some things in the program. Apache Commons Configuration2 uses a lot of strategies and factories, and…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
4
votes
1 answer

How to get list of entries in properties file using Apache commons config?

In my project we have a properties file which has some entries as below: #Data key entries datakey001 datakey321 datakey451 someotherkey In fact its not a key value pair, but a list of keys. Using java.util.Properties I was able to get this using…
jacobcs
  • 539
  • 5
  • 14
4
votes
0 answers

Reading an array from XML into a bean using Apache Commons Configuration and BeanUtils

In a configuration file I have multiple array values, for example names for a phonebook. John Mary I want to read these into this bean via…
4
votes
2 answers

Commons XMLConfiguration and schema validation?

I using Apache Commons XMLConfiguration for my configuration. Now I need a schema based validation. But I have problems to add my xsd to the XMLConfiguration. The xsd is locateded in the application jar file. If I use methods from Java SE the…
user3612610
  • 233
  • 4
  • 18
4
votes
1 answer

Property change listener for Archaius

I'm using Archaius to keep system properties aligned between all the servers hosting my app. I can see all the property getters can take a callback to be called whenever that property changes (for instance see the third argument in…
Cameron
  • 1,868
  • 3
  • 21
  • 38
4
votes
2 answers

What should be the strategy to migrate configuration files to new version?

I understand this is question is completely implementation dependent, but would like to know the general strategy used to migrate the configuration files. We have a product that reads some configurations from properties/XML files. Some default…
sidgate
  • 14,650
  • 11
  • 68
  • 119
4
votes
3 answers

Apache commons configuration cache

I'm looking how I can cache my property in apache-commons-configuration framework. It tooks a long time to obtain a property from different places, defined in my config.xml. So, is there a cached (by time, for example) implementation of…
Alexey Kutuzov
  • 679
  • 8
  • 22
1
2
3
9 10