nacos-group / nacos-spring-boot-project

Nacos ECO Project for Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

application.properties中nacos.config.auto-refresh配置项不起作用

aricc opened this issue · comments

application.properties中nacos.config.auto-refresh配置项设置为true,也不能自动刷新。
必须在NacosValue注解中设置autoRefreshed为true才可以自动刷新,如下所示:
@NacosValue(value = "${test.prop1:}",autoRefreshed = true) private String prop1;

如果设置了NacosValue注解中autoRefreshed为true,这时即使application.properties中nacos.config.auto-refresh配置项设置为false,也可以实现自动刷新。
那也就是说application.properties中nacos.config.auto-refresh配置项压根没什么用,那还留着它干嘛?还误导人。

确实,感觉很多东西都不完善。。这些基本的功能能不能先处理好,老想着开发什么高大上的东西

application.properties中nacos.config.auto-refresh 是指application.properties有更新是否需要同步到client端。
@NacosValue 里的autoRefreshed 是指 是本地aplication.properties更新是否需要刷新字段的值。
所以如果需要刷新字段的值,两个地方都需要配置才可以