Is it possible to store characters such as : ; / , . in the keys in map in Java that's mapped through application.yml?
I'm trying to store URIs and a value associated with them through a mapping in application.yml file however since it's a key, it doesnt save any of the special characters
http://localhost:8080 becomes httplocalhost8080
Is there any way to preserve those lost characters?
~~EDIT~~ I've tried escape characters, double, and single quotes around the keys and still once they are in the hashmap, they are ignored.
The property in the yml file has this structure:
uri-example-config:
keyToValueMap:
http://localhost:8080 : String1
http://exmaple.com: String2
http://moreURIs.com: String2
And then my config is:
@Configuration
@ConfigurationProperties(prefix = "uri-example-config")
@EnableConfigurationProperties
@Getter
@Setter
public class URIProperties {
private Map<String, String> keyToValueMap = new HashMap<>();
}
~~~~EDIT 2~~~~
Yes, i can easily map.put("http://localhost:8080"...) and the strings is preserved as expected. Doing it through yml file with config and properties causes this issue.