spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
704 stars 701 forks source link

Bootstrap fails when embedding config server #1257

Open tcbcw opened 1 year ago

tcbcw commented 1 year ago

When embedding a Cloud Config Server and bootstrapping from that config server, the steps require using the spring.cloud.config.server.bootstrap: true flag. https://cloud.spring.io/spring-cloud-config/multi/multi__embedding_the_config_server.html

However, the bootstrapping has been deprecated and was broken with the fix for #1158 . Previous to this fix, when bootstrapping, two contexts would be created. The top-level was the bootstrap context and the second level was the application's context. The bootstrap context contained the bean for org.springframework.cloud.config.client.ConfigClientProperties, but the application context contained the propertySource for bootstrap.yml.

Before the fix for #1158, the ConfigurationPropertiesRebinder would bind the bean found in the bootstrap context using the application context's propertySources. I agree that this seems wrong, and can cause issues like described in #1158, however, now that the bean and propertySources need to be in the same context, I can't see a way to get an application to bootstrap properly. I believe this is a bug.

The last working version was org.springframework.cloud:spring-cloud-context: 3.1.4.