在Spring Boot项目中,当application.properties文件跟nacos上面有相同的配置时,通过@NacosValue获取不到Nacos上面的配置内容
application.properties里面的配置
nacos.config.server-addr=192.168.14.15:8848
spring.application.name=nacos-config-demo
接口代码
@RestController
public class ConfigController {
@NacosValue(value = "${girl:zhang}", autoRefreshed = true)
private String girl;
@GetMapping(value = "/test")
public String test() {
return girl;
}
}