Closed jaschenk closed 1 year ago
You said in the Spring Cloud issue that the problem occurs with a single multi-document YAML file and without involving Spring Cloud Config. Can you please provide a minimal example of that?
Hello, attached in a zip of a redacted application.yml file. Which is a Multi-Document YAML file. If I reference this using 'dev' profile, I see 'prd' leaking into property values.
If I eliminate all other profiles below the 'dev' profile, the service boots with the correct property values. application.zip
Also, I tried using a property file generated from my YAML using the new #--- profile separators and that failed as well. And if for some reason you end the Multi-Document yaml using a '---' separator other weirdness occurs.
Please advise if you need any additional information.
Many Thanks, Jeff
@jaschenk Thanks for the YAML file, but we really need a complete application that we can run and debug to diagnose the problem. Are you able to provide a minimal reproducible example application as either a GitHub project or attached to this issue as a zip. Ideally the sample won't include any Spring Cloud dependencies.
@philwebb Put together simple demo, but unable to reproduce in a simple demo. It must be something with the inclusion of config server in some way or other dependency in stack, but not sure. Will keep investigating on my side to see if I can get additional insight. Thanks, Jeff
Looks like issue is in fact related to cloud config. Used a work around of creating distinct application-
In Spring Boot using cloud config client pulling Multi-document YAML leaks the last profile properties into runtime configuration, from either config server or on classpath.
I originally opened this under spring-cloud-config for client, but reviewer suggested Spring Boot should be where this issue should be created. https://github.com/spring-cloud/spring-cloud-config/issues/2215
Migrating to Spring Boot 3.0.1 and using Spring-cloud-config-client version 4.0.0, it appears there has been some regression in processing the configuration files, either from classpath or from config server.
In a multi-document YAML configuration file on the configuration server and initial 'application.yml' file specifies spring.config.import to initiate the configuration to be pulled.
Example
When specify the spring.active.profles=dev, we see 'dev' profile being used, but after a short time the 'prd' property values are injected!
We should see ' https://api2-dev.xyz.com/someendpoint' as our dev uri, instead it is populating with the 'prd' value: 'https://api2.xyz.com/someendpoint'.
This appears to be also related to Issue # 1761: https://github.com/spring-cloud/spring-cloud-config/issues/1761 .
Please advise on what additional information you may need to further debug.
Many thanks, Jeff Schenk