Which Component
Nacos Config (spring-alibaba-nacos-config)
Describe the bug
When using spring-alibaba-nacos-config:2025.0.0.0 with Spring Boot 3.5.9 and spring.config.import=nacos:..., remote configuration can be loaded successfully at startup, but runtime refresh does not work correctly after the config is changed in Nacos.
After debugging the refresh flow, I found two related problems:
NacosPropertySourceRefreshListener cannot always locate the existing Nacos PropertySource in Environment, because the lookup key used in refresh does not match the actual property source name used by the ConfigData import path.
NacosPropertySourceRefreshListener rebuilds the property source with "properties" as the file extension, which is incorrect for configs imported as yml/yaml/json/xml.
As a result, the runtime Environment still exposes old values after a Nacos config change.
Simplest demo
I do not have a public demo repo at the moment, but the issue can be reproduced with a minimal Spring Boot application using:
- Spring Boot
3.5.9
spring-alibaba-nacos-config:2025.0.0.0
nacos-client:2.3.2
spring.config.import=nacos:...yml?group=DEFAULT_GROUP&refreshEnabled=true
Minimal configuration:
spring:
application:
name: demo-app
config:
import:
- "nacos:${spring.application.name}.yml?group=DEFAULT_GROUP&refreshEnabled=true"
nacos:
config:
group: DEFAULT_GROUP
refresh-enabled: true
Which Component
Nacos Config (
spring-alibaba-nacos-config)Describe the bug
When using
spring-alibaba-nacos-config:2025.0.0.0with Spring Boot3.5.9andspring.config.import=nacos:..., remote configuration can be loaded successfully at startup, but runtime refresh does not work correctly after the config is changed in Nacos.After debugging the refresh flow, I found two related problems:
NacosPropertySourceRefreshListenercannot always locate the existing NacosPropertySourceinEnvironment, because the lookup key used in refresh does not match the actual property source name used by the ConfigData import path.NacosPropertySourceRefreshListenerrebuilds the property source with"properties"as the file extension, which is incorrect for configs imported asyml/yaml/json/xml.As a result, the runtime
Environmentstill exposes old values after a Nacos config change.Simplest demo
I do not have a public demo repo at the moment, but the issue can be reproduced with a minimal Spring Boot application using:
3.5.9spring-alibaba-nacos-config:2025.0.0.0nacos-client:2.3.2spring.config.import=nacos:...yml?group=DEFAULT_GROUP&refreshEnabled=trueMinimal configuration: