nacos的配置如下:
free:
share:
url: precenter.es.com
num: 3
url: es.com
配置类如下:
@Data
@Configuration
//@ConfigurationProperties(prefix = "free")
@NacosConfigurationProperties(prefix = "free", groupId = "${nacos.config.group}", dataId = "${nacos.config.data-id}", autoRefreshed = true, type = ConfigType.PROPERTIES
)
public class FreeConfig {
private Map<String, Object> share;
private String url;
}
运行后,url属性成功注入,但是share为null,无法注入成功。添加ignoreUnknownFields = false属性后,运行报了如下错误:
Bean property 'free[share.url]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter
nacos的配置如下:
配置类如下:
运行后,url属性成功注入,但是share为null,无法注入成功。添加ignoreUnknownFields = false属性后,运行报了如下错误:
Bean property 'free[share.url]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter