I have a property file as below
Key1~~value1
Key2~~value2
How to read this custom separator property file using Spring.
Spring @PropertySource can read the property files with keys and values separated by = or :.
I have a property file as below
Key1~~value1
Key2~~value2
How to read this custom separator property file using Spring.
Spring @PropertySource can read the property files with keys and values separated by = or :.
On the presumption that you are using a created properties file. You can use the setGlobalSeparator(String globalSeparator) method of PropertiesConfigurationLayout and change the separator to use ~~. Per the documentation, it will overwrite the existing configuration layout to set the new global separator.
Something like this:
PropertiesConfiguration propertiesConfig = new PropertiesConfiguration("test.properties");
PropertiesConfigurationLayout layout = new PropertiesConfigurationLayout(propertiesConfig);
layout.setGlobalSeparator("~~");
propertiesConfig.setLayout(layout);