Given an application.properties file:
myProperties.map.key1=value1
myProperties.map.key2=value2
myProperties.map.key with space=value3
And the properties class:
@ConfigurationProperties
public class MyProperties {
private Map<String, String> map;
// getters and setters
}
I have tried to escape the spaces like key\ with\ space
or even key\u0020with\u0020space
but both still ended up as keywithspace
in the map. Please point out the correct way to add key with space to map using Spring application.properties, thank you.