Open JordiMartinezVicent opened 2 years ago
After removal, I think it should not be reset to the default value. After removal, it should be set to null
Hello, this issue also affects Maps. A key removed from the properties is not removed from the map on properties rebind. This seems to come from MapBinder.merge() that doesn't check for removed keys.
Spring boot version: 2.6.10 Spring Cloud version: 2021.0.2
Describe the bug Consider a ConfigurationProperty bean which has a default value defined at the code:
The initial value of the bean
MyConfigProps#myProp = 0
, as it is defined at the code.When the property changes at the environment
org.jordi.my-prop=1
and the rebind is executed, the value of the bean MyConfigProps#myProp changes to 1. Which is great.But when the same property is removed from the environment and the rebind is executed again, the value of the bean MyConfigProps#myProp remains to 1 instead of changing the value to the initial value.
Sample
See the behavior described at the following test: