nacos-spring-boot-project icon indicating copy to clipboard operation
nacos-spring-boot-project copied to clipboard

yml配置刷新 开启autoRefreshed为啥不刷新配置呢?

Open ssun-o1 opened this issue 3 years ago • 4 comments

nacos-config-spring-boot-starter (version-0.2.8) yml文件开始预加载 bootstrap.enable & autoRefreshed:true 为什么不刷新配置呢?

ssun-o1 avatar Dec 08 '21 05:12 ssun-o1

我的是springboot2.0.0+nacos-config-spring-boot-starter0.2.7 也遇到这问题,不自动刷新

elang0705 avatar Jan 12 '22 14:01 elang0705

用的哪个注解?

hujun-w-2 avatar Jun 30 '22 09:06 hujun-w-2

NacosValue(value = "${xxx}", autoRefreshed = true) 就不会自动刷新。 必须在 启动类上添加 @NacosPropertySource(dataId = "xxx", autoRefreshed = true) 才能自动刷新。 这是为啥? 已经在 application.yml 里配置了。nacos.config.auto-refresh=true 了, 但完全没有生效。 稍微跟了下源码。 NacosPropertySource 注解和 NacosConfigProperties 走的两条路径。 @hujun-w-2 麻烦看下。 NacosPropertySource 是否必须

zhuqingchao avatar Aug 04 '22 09:08 zhuqingchao

NacosValue(value = "${xxx}", autoRefreshed = true) 就不会自动刷新。 必须在 启动类上添加 @NacosPropertySource(dataId = "xxx", autoRefreshed = true) 才能自动刷新。 这是为啥? 已经在 application.yml 里配置了。nacos.config.auto-refresh=true 了, 但完全没有生效。 稍微跟了下源码。 NacosPropertySource 注解和 NacosConfigProperties 走的两条路径。 @hujun-w-2 麻烦看下。 NacosPropertySource 是否必须

NacosPropertySource注解和yml中主配置及ext-config[index]配置的关系及使用场景是怎么样的,哪里有具体文档说明?我试过这种场景: 启动类中加上注解NacosPropertySource ,并且在yml配了主配置nacos.config.auto-refresh=true,nacos.config.bootstrap.enable=true,NacosValue(value = "${xxx}", autoRefreshed = true)依然不会自动刷新; 以上不配置bootstrap.enable=true,NacosValue就可以刷新。

andyge2014 avatar Feb 24 '23 10:02 andyge2014