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
Document that the Map backing a MapPropertySource should not contain null values #25142
Comments
This is intentional as far as I see, with |
On review, I'd rather let |
Reading through the Boot issue, maybe affected |
@jhoeller
If I try to override
or
or
nothing happens, application will get
in every mentioned case. |
@rgordeev I missed those from the original report. I've reopened the Spring Boot issue. |
Thanks @jhoeller, I'll reopen the Boot issue and update this one as documentation for |
Sometimes results of overriding are not obvious at all. You may see test cases Tests Test case Defaults
Test case With Empty Lists
We are trying to override
Test case With Empty Objects
We are trying to override
Test case With Empty Strings
We are trying to override
Test case With Non null Values
We are trying to override
Test case With Null values
We are trying to override
|
E.g.
|
See spring-projects/spring-boot#21542 for background.
Currently a
PropertySource
can legitimately containnull
values. For example, aMapPropertySource
can returntrue
fromcontainsProperty
andnull
fromgetProperty
if the backingMap
has an entry with a null value.The
PropertySourcesPropertyResolver
class currently treats null results as missing properties. This makes if impossible for a higherPropertySource
to override a lower one with anull
value.The resolver could call
containsProperty
to check for a value and allownull
results, however, this has some downsides:I've raised this issue to discuss if the design is intentional or not.
The text was updated successfully, but these errors were encountered: