feature: config support profile and multiple values (#3552) - #3553
feature: config support profile and multiple values (#3552)#3553wangYX657211334 wants to merge 2 commits into
Conversation
'spring.config.import with nacos' support profile and multiple values
|
that's the wanted feature, pls merge ASAP |
|
We recommend specifying the specific dataId and group directly through spring.config.import. If you need to specify a profile, we suggest using a ${} placeholder in the dataId, such as spring.cnfig.import=nacos: application-${profile}. yml&group=mygroup |
oss-sentinel-ai
left a comment
There was a problem hiding this comment.
Summary
This PR adds profile-specific configuration loading to NacosConfigDataLocationResolver, enabling Spring Cloud Nacos to load profile-aware config files (e.g., application-dev.yml alongside application.yml). This aligns with Spring Boot's standard config data behavior.
Review Notes
- Feature value: Profile-specific config loading is a standard Spring Boot feature. Adding it to the Nacos config data resolver improves consistency with Spring Cloud Config and Kubernetes config providers.
- Implementation: The
getProfileConfigDataLocation()method correctly handles optional prefix, extension preservation, and query parameter positioning. - [Warning] Backward compatibility: This changes the config loading behavior — existing deployments that rely on the current single-file loading may see additional config files being loaded. Please document this behavior change and consider adding a property to disable profile-specific loading if needed.
- [Info] Test coverage: Good that tests are included. Consider adding edge case tests for:
- Config locations with query parameters (e.g.,
nacos:app.yml?group=xxx) - Multiple active profiles
- Optional prefix handling (
optional:nacos:app.yml)
- Config locations with query parameters (e.g.,
Cross-repo Note
If this feature is merged, the official docs should be updated to explain profile-specific config loading behavior.
Automated review by github-manager-bot
'spring.config.import with nacos' support profile and multiple values
Describe what this PR does / why we need it
Keep consistent with spring boot config resolver behavior
Does this pull request fix one issue?
#3552
Describe how you did it
modify
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverDescribe how to verify it
#3552
Special notes for reviews