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).