Describe the bug Spring Cloud version = 2020.0.4+
Issue When providing multiple values as list for config server url, the last URL is only used. The call is also tried 4 times because 4 imports have been provided. My expectation is at any time only 1 of the 4 placeholders will have value and the springboot app will be automatically be able to use that to call the config server of that environment level.
Sample Providing configuration in application.yml
spring:
config:
import:
- optional:configserver:\${vcap.services.config-service-development.credentials.uri}
- optional:configserver:\${vcap.services.config-service-integration.credentials.uri}
- optional:configserver:\${vcap.services.config-service-volume.credentials.uri}
- optional:configserver:\${vcap.services.config-service-production.credentials.uri}
Logs:
{"timestamp":"2021-12-07T15:43:14.969Z","msg":"The following profiles are active: local","logger":"c.l.MyApplication","thread":"main","level":"INFO","app":"my-app}
{"timestamp":"2021-12-07T15:43:15.015Z","msg":"Could not locate PropertySource ([ConfigServerConfigDataResource@fff25f1 uris = array
Comment From: ryanjbaxter
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
Comment From: harshadloya
Attaching the zip file as requested. It is a simple springboot app initialized from the spring initializer with spring cloud config client dependency.
cloud-config-issue-sample-app.zip
Comment From: ryanjbaxter
The problem appears to be here https://github.com/spring-cloud/spring-cloud-config/blob/main/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLocationResolver.java#L122
Comment From: harshadloya
Will this fix be available in 2020.0.5 or the latest version planned for that release as well ?
Comment From: ryanjbaxter
We can try and port it to the 2020.0.x release train as well.