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
0
votes
1 answer

Storing properties within database using Commons Configuration

I want to store some properties in a database table. I'm using Apache Commons Configuration 2.1. I found this, but I can't make it to work... I've googled around, but I haven't found any documentation or examples but the link I've written…
joninx
  • 1,775
  • 6
  • 31
  • 59
0
votes
1 answer

Issues while loading properties files from samza job running on yarn cluster

I have a samza job which I am trying to run on yarn cluster using ./bin/run-job.sh --config-factory=org.apache.samza.config.factories.PropertiesConfigFactory --config-path=file:///home/anshu/samzaJob.properties The job triggers and runs fine…
Ansh
  • 357
  • 1
  • 2
  • 13
0
votes
1 answer

Reloading a Commons Configuration 2 Spring bean

I've been using the reload feature of Commons Configuration v1 without any extra coding when exposing a Configuration object as a Spring @Bean, because the reload check was performed every time the Configuration was accessed. I'm now trying to…
xtian
  • 2,908
  • 2
  • 30
  • 43
0
votes
1 answer

Spring config properties from database and properties

I asked a similar question, but based on the responses, I did a bad job describing what I am after. I have a spring 4 webapp that loads properties from a properties file. We consume those properties both via the "${proper.name"} expressions in…
Entropy
  • 1,219
  • 6
  • 21
  • 45
0
votes
1 answer

Store properties in database, but override locally

Currently, we store our application's environment properties in a .properties file in the WEB-INF. We want to move them to a database table. But we still want to specify the jndi name, and when running in our test environment locally, we want to…
Entropy
  • 1,219
  • 6
  • 21
  • 45
0
votes
0 answers

Is there any way to add class path to property file?

I am trying to write a property file and wanted to add one classpath resources. Is there any way to add class path to property file? Example : I am creating example1.properties using java properties which are having Following Properties key1 =…
Animesh Agrawal
  • 161
  • 2
  • 16
0
votes
1 answer

Spring with RabbitMq and Apache Commons Config: Constructor threw exception; nested exception is java.lang.NullPointerException

I'm simply trying to autowire the following rabbitmq consumer: @Component public class SmsQueueConsumer { //NOT SURE IF/ WHY THE CONFIG IS NULL... @Autowired Configuration config; public SmsQueueConsumer() throws Exception { …
Matt
  • 5,408
  • 14
  • 52
  • 79
0
votes
1 answer

Apache commons config: Generate configuration file from defaults

I want to distribute my application in one jar. That means that I do not want to ship any external files with it, that also includes that I do not want to ship the default configuration file with my project. I could for sure build the basic XML…
randers
  • 5,031
  • 5
  • 37
  • 64
0
votes
1 answer

Not able to read config.properties using Commons Configuration in a maven web project

I'm trying to read config.properties file placed in src/main/resources folder for my maven web project, using Commons-configuration api. I'm able to use it without any issues for a normal maven project but in web project this somehow doesn't work.…
Sandeep Raikar
  • 491
  • 1
  • 6
  • 13
0
votes
1 answer

How to create an XMLConfiguration on demand

I'm using commons-configuration 1.10 and would like to have my configuration file created only when needed. For now, I have XMLConfiguration config= new XMLConfiguration(file); config.setReloadingStrategy(new…
Riduidel
  • 22,052
  • 14
  • 85
  • 185
0
votes
0 answers

Updating config file inside a jar programatically

I'm writing a converter which should convert file A to file B. Doing so, I'm using the config API from Apache Commons Configuration to filter those files so not every entry will be converted. Now I made a jar file which has the config file inside…
X-Fate
  • 323
  • 4
  • 13
0
votes
0 answers

Apache Commons Configuration: Keep database connection open

We use Apache Commons Configuration 1.8 with Java 7. One of the data sources is a PostgreSQL database, accessed via DatabaseConfiguration in a class which acts as a singleton. Demo configuration initialization: private void init() { // ... …
Markus L
  • 932
  • 2
  • 20
  • 38
0
votes
2 answers

How to make a parametric configuration file?

I have a question about configuration files. Is it possible to create a file.properties in java (example with Apache Commons Configuration) as: name = tom surname = donald free string = my favourite color is + paramFromJavaCode where…
django
  • 153
  • 1
  • 5
  • 19
0
votes
1 answer

Apache Commons CompositeConfiguration XPath exception on getProperty(".propertyName")

I have a CompositeConfiguration object which has some property configurations and some XMLConfigurations.For the XMLConfiguration, the DefaultExpressionEngine is set as XPathExpressionEngine One of the .properties file has properties starting with…
0
votes
4 answers

How to get properties without it being delimited?

I'm using commons-configuration v1.10 and I'm using the class PropertiesConfiguration to read in my applications properties. I have a property which has commas in it, but when I read it in, it gets delimited, and I can't figure out how to get it not…
samwell
  • 2,757
  • 9
  • 33
  • 48
1 2 3
9
10