Skip to content

ConfigFileApplicationListener filtering fails when the defaultPropertySource is a composite #17011

Closed
@ryanjbaxter

Description

@ryanjbaxter

Prior to Boot 2.2.0 if you used spring-cloud-starter and within your bootstrap.yml set spring.config.name Boot would correctly load the property file specified in the property. Starting with Boot 2.2.0 this no longer works.

I have traced the breaking change down to this line added in commit d92c2f7

In the situation I described above defaultProperties is actually an instance of ExtendedDefaultPropertySource defined here.

The sources property, which is a composite, contains the value of spring.config.name in this case. However in ConfigFileApplicationListener.replaceDefaultPropertySourceIfNecessary the code just calls .getSource to construct the new defaultProperties so we loose the properties in the composite and therefore the spring.config.name property is never retrieved.

For a sample that reproduces the problem you can look at this test.

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions