spring-cloud / spring-cloud/spring-cloud-commons

spring.cloud.config.profile with dash in profile name is ignored from config server

Open
#1,104 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Describe the bug
Using spring-cloud-config-client 3.1.1. I'm running an application in Azure Spring Cloud with a configured Config Server connecting to github. When I try to start the application with jvm option -Dspring.cloud.config.profile=azure-test it fails with exception ConfigClientFailFastException: Could not locate PropertySource and the fail fast property is set, failing: None of labels [] found. There is an application-azure-test.yml file in the github config repo and using this file locally works, so it's not the naming convention or configuration itself that's the problem.
The application log of the Azure instance shows application.yml being loaded, and I also tested it with application-aztest.yml (no dash in profile part) and that is also loaded, so my conclusion is that the extra dash is causing problems reading configuration from the config server.
2022-05-04 11:37:13.796 INFO 1 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/***/**.git/application-aztest.yml'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/***/**.git/application.yml'}]

Sample
This can be reproduced by placing a configuration file with the pattern application-azure-test.yml in a config repo and starting a cloud service with jvm option -Dspring.cloud.config.profile=azure-test

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with spring-cloud-config-client 3.1.1, a config repository containing application-azure-test.yml, and -Dspring.cloud.config.profile=azure-test. Trace how the config client requests the profile from the config server, then verify that the dashed profile loads alongside application.yml and that the fail-fast startup error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.