我正在使用Spring-boot应用程序,我可以在其中连接Azure应用程序配置。但是当我尝试使用内容类型application/JSON来读取值时,得到了这个错误。
我的Java类
@ConfigurationProperties(prefix = "config")
@Getter
@Setter
public class AppConfigProperties {
private String test;
private Map<String, Map<Integer, List<Integer>>> map;
}
应用配置
key: map
value: {"Cream":{"1":[2,3,4],"2":[25]},"Ice":{"1":[2,3,4],"2":[25]}}
content type = application/json
错误:
Description:
Failed to bind properties under 'config.map' to java.util.Map<java.lang.String, java.util.Map<java.lang.Integer, java.util.List<java.lang.Integer>>>:
Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.util.Map<java.lang.Integer, java.util.List<java.lang.Integer>>>]
Action:
Update your application's configuration
发布于 2021-11-01 12:32:05
而不是转换字符串和整数。您可以用作object
。
您可以轻松地将对象转换为其他数据类型。
私有Map>映射;
您可以使用
@JsonIgnore
private Map<String, Object> properties = new HashMap<String, Object>();
参考here
https://stackoverflow.com/questions/69735659
复制相似问题