spring-cloud / spring-cloud/spring-cloud-config
Configuration is not resolved properly with profile and label
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 1.3k
- Avg merge
- 2d 59m
- Merged PRs (30d)
- 16
Description
Describe the bug
For some profiles (production), we use the spring.cloud.config.label property, to fetch a specific tag from the Cloud Config server - configured with on-profile property. Despite this, the configuration is read from the master (default) branch instead of the specified tag.
The configuration we use:
---
spring:
config:
activate:
on-profile: epos_prod,epos_rc
cloud:
config:
label: v2.65
When running the application with option -Dspring.profiles.active=rc,epos_rc, the configuration is clearly read from the master (default) branch instead of the specified v2.65 (a property removed after this version is missing). If we explicitly add the -Dspring.cloud.config.label=v2.65 to application Java options, the correct tag is used.
In the log files we can see three entries related to locating the environment:
2025-06-25 15:43:10 INFO [main] ServerApplication : [] The following 3 profiles are active: "epos", "rc", "epos_rc"
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Fetching config from server at : http://localhost:9000
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Located environment: name=commons,portal, profiles=[default], label=null, version=1fd890a439796678449be5e345d5249d47070b43, state=
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Fetching config from server at : http://localhost:9000
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Located environment: name=commons,portal, profiles=[epos,rc,epos_rc], label=epos-v2.65, version=7b38f9138627e08fb2e7de08bcf7cfb1e46c7ea6, state=
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Fetching config from server at : http://localhost:9000
2025-06-25 15:43:10 INFO [main] ConfigServerConfigDataLoader : [] Located environment: name=commons,portal, profiles=[default], label=epos-v2.65, version=7b38f9138627e08fb2e7de08bcf7cfb1e46c7ea6, state=
When additionally using the -Dspring.cloud.config.label=v2.65 option, the first entry (with profiles=[default], label=null) is not generated.
Used with Spring Boot version: 3.4.4, tested also with 3.4.7.
Worked with previous versions, probably with 3.3.x (why only probably: logs from the time when we were using it have only one entry with "Located environment", but we might not have the differences in cloud config that would make the bug manifest then).
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 with the ConfigServerConfigDataLoader entry point named in the logs and trace how profile-specific configuration and the spring.cloud.config.label value are resolved. Compare behavior on Spring Boot 3.4.4 or 3.4.7 with the previous 3.3.x behavior. Done means the configured label is used without the JVM property override, with a regression test covering the reported profile setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java, spring, spring-boot
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100