spring-cloud / spring-cloud/spring-cloud-consul
New property `spring.cloud.consul.config.prefixes` doesn't work the same way as the deprecated `spring.cloud.consul.config.prefix`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 822
- Forks
- 539
- Avg merge
- 9h 31m
- Merged PRs (30d)
- 7
Description
Describe the bug
When migrating our Spring Boot services to 3.5, we also migrate some of our deprecated properties to the new ones.
But there's an issue where consul was not working, consul properties was not loaded even though it's working before.
After tracing & debugging for several hours, turned out it's because the new property spring.cloud.consul.config.prefixes doesn't work the same way as the deprecated spring.cloud.consul.config.prefix when it's set to empty string ""
This works:
spring.cloud.consul.config.prefix=
spring.cloud.consul.config.name=config/my-service
This doesn't:
spring.cloud.consul.config.prefixes=
spring.cloud.consul.config.name=config/my-service
Because the latter will lead to empty context on ConsulPropertySources#generateAutomaticContexts.
Setting the new property with any prefix then empty string, however, works:
spring.cloud.consul.config.prefixes=anything,
spring.cloud.consul.config.name=config/my-service
So the question is:
- Is the new property
spring.cloud.consul.config.prefixesintended to be never empty? - If
spring.cloud.consul.config.prefixis removed later and we want to keep using empty prefix - using...config.namefor the full path, is setting the....config.prefixestoanything,a correct workaround?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ConsulPropertySources#generateAutomaticContexts and compare how the deprecated prefix and the new prefixes property handle an empty value. Reproduce the two configurations from the issue and determine whether an empty prefixes value should preserve the full path from config.name; done means the intended behavior or workaround is documented and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100