Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultProperties property source is not propagated to the new context created in the LegacyContextRefresher for refreshing properties #892

Closed
mzeijen opened this issue Jan 28, 2021 · 2 comments
Labels
Projects
Milestone

Comments

@mzeijen
Copy link
Contributor

mzeijen commented Jan 28, 2021

Bug introduced with Spring Cloud Context version: 3.0.0

When the LegacyContextRefresher is used to refresh the Spring environment properties, the temporary context created by the LegacyContextRefresher, does no longer get the defaultProperties property source propagated from the original environment.

The reason for this is because the properties method of the SpringApplicationBuilder is now used to provide the spring.cloud.bootstrap.enabled=true property to the builder. This results in the defaultProperties property source from the copied environment to be overwritten by a new property map containing only the spring.cloud.bootstrap.enabled property.

To put this in sequence (with line references to the code):

The solution would be to provide the spring.cloud.bootstrap.enabled=true via other means, for instance by adding it to the default properties of the copied environment, instead of using the properties method of the SpringApplicationBuilder.

@slyoldfox
Copy link

Also spend 3 hours to find this same case. I am not sure if this is a spring-cloud bug or also a spring-boot bug. Seems to me that DefaultPropertiesPropertySource might want to merge if another DefaultPropertiesPropertySource exists?

Could this be confirmed or am I doing something wrong, any workarounds? @philwebb

@philwebb
Copy link
Contributor

@slyoldfox I think that makes sense. I don't think we ever considered the scenario before. I've raised spring-projects/spring-boot#25408

@spencergibb spencergibb added this to To do in 2020.0.2 via automation Mar 16, 2021
@spencergibb spencergibb added this to the 3.0.2 milestone Mar 16, 2021
2020.0.2 automation moved this from To do to Done Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
2020.0.2
  
Done
Development

No branches or pull requests

5 participants