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
ConfigFileApplicationListener filtering fails when the defaultPropertySource is a composite #17011
Comments
See #15445 |
@philwebb I read the issue, but that is all about profiles, this problem has nothing to do with profiles. To add to this, I also think these changes broke this functionality as well, which does have to do with profiles. |
@ryanjbaxter The commit that you referenced fixed the issue that Phil referenced. |
@ryanjbaxter I just added a link to the issue referenced in commit d92c2f7 |
@wilkinsona @philwebb sorry I misinterpreted what you were saying ;) |
@ryanjbaxter I tried to run For |
@philwebb did you remove the
@spencergibb @dsyer do you know? I am a little unsure. |
I'm not sure either. |
Doh! 🤦♂ |
Actually, even with the |
Weird not sure, it is failing for me on my machine |
I'm able to reproduce this. As @ryanjbaxter mentioned, it's because we use |
@ryanjbaxter I've implemented the fix suggested by @mbhave, both Spring Cloud tests referenced in this issue work for me locally now. |
@philwebb I removed the |
FWIW, it also fails for me when built locally with |
Looks like I was wrong about the same fix being able to fix both tests. I share what @philwebb said here:
I don't think a solution where the filtering only applies for Boot's |
I swear it worked in my IDE :/ I've opened #17141 to look at the failing test. It feels like a different issue and the composite property source problem has been fixed so let's keep this issue just for that one. |
Prior to Boot 2.2.0 if you used
spring-cloud-starter
and within yourbootstrap.yml
setspring.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 ofExtendedDefaultPropertySource
defined here.The
sources
property, which is a composite, contains the value ofspring.config.name
in this case. However inConfigFileApplicationListener.replaceDefaultPropertySourceIfNecessary
the code just calls.getSource
to construct the newdefaultProperties
so we loose the properties in the composite and therefore thespring.config.name
property is never retrieved.For a sample that reproduces the problem you can look at this test.
The text was updated successfully, but these errors were encountered: