Skip to content
Advertisement

Tag: properties-file

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 : Result : Expected Result : Answer Docs are here: https://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_properties.html Untested but I imagine this does it:

Immutable @ConfigurationProperties

Is it possible to have immutable (final) fields with Spring Boot’s @ConfigurationProperties annotation? Example below Approaches I’ve tried so far: Creating a @Bean of the MyProps class with two constructors Providing two constructors: empty and with neededProperty argument The bean is created with new MyProps() Results in the field being null Using @ComponentScan and @Component to provide the MyProps bean.

Advertisement