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
2
votes
3 answers

What going wrong in using PropertiesConfiguration?

For updating in my .properties file I am using Apache Commons Configuration's PropertiesConfiguration. But as I am using the code as : try { PropertiesConfiguration properties = new PropertiesConfiguration("dao.properties"); } catch…
Asif
  • 4,980
  • 8
  • 38
  • 53
2
votes
1 answer

Is it possible to supply a new PropertiesConfiguration file at runtime?

Background: I have a requirement that messages displayed to the user must vary both by language and by company division. Thus, I can't use out of the box resource bundles, so I'm essentially writing my own version of resource bundles using…
Mike Ryan
  • 4,234
  • 1
  • 19
  • 22
2
votes
1 answer

How To Make Commons Configuration's setListDelimiter Work?

I would like to use an alternate list delimiter in Apache Commons Configuration. However, despite trying a great many different ways of accessing a Configuration object and setting its list delimiter, I can never get it to actually use anything…
Randall Schulz
  • 26,420
  • 4
  • 61
  • 81
2
votes
1 answer

Cannot save to commons config in JBoss 5.1

I am writing a web application that uses Apache Commons config to read/write a system.properties file. The file itself is placed in WEB-INF/classes/config. Reading is no problem, and I can write to it when I deploy using Apache Tomcat. When I deploy…
MTR
  • 1,411
  • 4
  • 14
  • 23
2
votes
2 answers

Get specific XML Subvalues with Commons Configuration

Lets say we have the following XML: 1 1 2 2
Dominik Obermaier
  • 5,610
  • 4
  • 34
  • 45
2
votes
1 answer

How to build HierarchicalConfiguration object from xml string content?

I have xml String content which is passed as part of request body in rest API,
2
votes
1 answer

How to add new XML element to the root element of a hierarchical XML configuration with addProperty() in Apache Commons Configuration?

So I tried it with XPathExpressionEngine but it's not working. My XML file looks like this. 24/05/20 00:43:42 I want the end result…
Tony Stark
  • 2,318
  • 1
  • 22
  • 41
2
votes
0 answers

Apache Commons Configurations2

I am using Apache commons configuration2 to read and write JSON configuration. When I am trying to read a JSON file which contains any JSON Array with only one element. { "default":{ "recurrence_info":{ "days":[ …
2
votes
1 answer

Accessing Java configuration from multiple classes

I was exploring ways to do simple, plain-old file-based configuration in Java. I looked into Java's built-in Properties and the Apache Common Configuration library. For the latter, the distilled code is as follows: Configurations configs = new…
flow2k
  • 3,999
  • 40
  • 55
2
votes
2 answers

How -Dlogging.level JVM argument is handled in spring boot, spring cloud

I have a spring cloud application, which under the covers uses spring boot. In the bootstrap phase of the app I am using some classes from the apache commons config library under: org.apache.commons.configuration My application is started with this…
bitsofinfo
  • 994
  • 3
  • 16
  • 34
2
votes
1 answer

Apache Commons Configuration file import files

For Apache Commons Configuration, I am trying to load multiple java property files. I was wondering if it's possible to "import/include" other files in one file so I only need to load the first file and the rest will all be imported. E.g.…
Work of Art
  • 53
  • 1
  • 5
2
votes
1 answer

Apache Commons Configuration2 - multiple same name config files from classpath

What I am trying to do is the exact same thing as this question : Using Class.getResourcesAsStream to get Apache Commons Configuration but using Apache Commons Configuration 2. So far, I have tried to make a first maven project with test.properties…
pwillemet
  • 613
  • 5
  • 21
2
votes
2 answers

Issue reading XMLConfiguration files using apache configuration2

I was trying to use apache commons configuration and running into an issue where it throws a NoClassDefFoundError. It happens on Parameters.xml() call. Below is the full code and the exception details that my IntelliJ generated. I am using…
user3885927
  • 3,363
  • 2
  • 22
  • 42
2
votes
1 answer

Apache Commons : List Handling in CompositeConfiguration

I have two configuration files : override.xml looks like this ... 1 2 3 100 200 default.xml looks like this ...
Adam
  • 21
  • 4
2
votes
2 answers

dynamic reload in apache DatabaseConfiguration

Has anyone developed a dynamic reload mechanism for the apache commons database configuration object?
YaOg
  • 1,748
  • 5
  • 24
  • 43