spring-cloud-commons
spring-cloud-commons copied to clipboard
spring.cloud.config.profile with dash in profile name is ignored from config server
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
Can you please try Spring Cloud 2021.0.2?
@ryanjbaxter Same exception:
Picked up JAVA_TOOL_OPTIONS: -Dspring.profiles.active=azure-test -Dspring.cloud.config.profile=azure-test OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended 2022-05-04 13:36:14.283Z INFO c.m.applicationinsights.agent - ApplicationInsights Java Agent 3.2.8 started successfully (PID 1) 2022-05-04 13:36:14.286Z INFO c.m.applicationinsights.agent - Java version: 17.0.2, vendor: Microsoft, home: /usr/lib/jvm/msopenjdk-17-amd64 13:36:20.358 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.cloud.config.client.ConfigClientFailFastException: Could not locate PropertySource and the fail fast property is set, failing: None of labels [] found
It does work with profile=aztest