Ashan
Ashan

Reputation: 59

How to create properties without white spaces between separator using org.apache.commons.configuration.PropertiesConfiguration?

Need to write a properties file using org.apache.commons.configuration.PropertiesConfiguration and it should have a format like variablename=variablevalue without having whitespaces between the separator. Is there a way to achieve that using apache commons-configuration?

My current implementation :

PropertiesConfiguration conf = new PropertiesConfiguration("test.properties");
conf.setProperty("key1","value1");
conf.save();

Result :

key1 = value1

Expected Result :

key1=value1

Upvotes: 1

Views: 588

Answers (1)

drekbour
drekbour

Reputation: 3081

Docs are here: https://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_properties.html

Untested but I imagine this does it:

conf.getLayout().setGlobalSeparator("=");

Upvotes: 3

Related Questions