[ad_1]
I try to use String with json like this
{"group1": {"group11": {"name": "element1", "link": "<LINK>"}, "group12": {"name": "element2", "link": "<LINK>"}},"group2": {"group21": {"name": "element3","link": "<LINK>"}}}
as configuration in my Spring application.
I added configuration like this in my application.yaml file:
my-config:
string-with-json: ${STRING_JSON}
other-option: string
and wrote property class:
@Data
@Configuration
@ConfigurationProperties("my-config")
public class BaseImagesProperties {
public Map<String, Map<String, Map<String, String>>> stringWithJson;
public String otherOption;
public String getLink(String group, String element) {
return stringWithJson.get(group).get(element).get("link");
}
}
When I started my app, it swears that he can’t convert a string to Map<String, Map<String, Map<String, String>>>
How can I properly convert it to this?
[ad_2]