Further paring down of leaky proeprty sources in Bootstrap phase
The biggest problem addressed here is one where an EnvironmentPostProcessor (reasonably) adds entries to the defaultProperties in the bootstrap context, but then that property source is not merged with the parent, or is merged too late (because it only happens when the application context parent is set). The result would be that things that were activated during bootstrap would be not be activated in the main context, or would be activated too late (early enough for beans to bind to but not for other listeners and post processors to get access to the additional properties). See https://github.com/spring-cloud/spring-cloud-sleuth/issues/126
This commit is contained in:
@@ -212,9 +212,9 @@ public class BootstrapConfigurationTests {
|
||||
.sources(BareConfiguration.class).run();
|
||||
assertEquals("main",
|
||||
this.context.getEnvironment().getProperty("spring.application.name"));
|
||||
// The parent is called "application" because spring.application.name is not
|
||||
// The parent has no name because spring.application.name is not
|
||||
// defined in the bootstrap properties
|
||||
assertEquals("application", this.context.getParent().getEnvironment()
|
||||
assertEquals(null, this.context.getParent().getEnvironment()
|
||||
.getProperty("spring.application.name"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user