以下是我的yaml配置。
configuration:
internalUser:
add:
city:
path: path
name: cityName
country:
path: path
name: countryName
replace:
city:
path: path
name: cityName
remove:
city:
path: path
name: cityName
externalUser:
add:
city:
path: path
name: cityName
country:
path: path
name: countryName
replace:
city:
path: path
name: cityName
remove:
city:
path: path
name: cityName
配置类如下所示:
@ConfigurationProperties(prefix = "configuration")
public class Configuration {
private Map<String, Map<String,Map<String>,Address>>> internalUser = new HashMap<>();
//setter and getter
}
Public class Address{
private String path;
private String name;
//setter and getter
}
加载应用程序时,它会失败并且无法投射对象。
我的配置有什么问题吗?还是可以将嵌套配置用于此配置?请帮我配置。
您有太多地图。
第一键: add, replace, remove
第二把钥匙: city
@ConfigurationProperties(prefix = "configuration")
public class Configuration {
private Map<String, Map<String, Address>>> internalUser;
private Map<String, Map<String, Address>>> externalUser;
//setter and getter
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句