MutablePropertySources has get and remove methods that look like this:
@Override
@Nullable
public PropertySource<?> get(String name) {
int index = this.propertySourceList.indexOf(PropertySource.named(name));
return (index != -1 ? this.propertySourceList.get(index) : null);
}
These attempt to find the index of a property source index by checking for the name. The PropertySource.named method returns a ComparisonPropertySource which depends on the inherited PropertySource equals and hashCode implementations.
The equals method looks like this:
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof PropertySource &&
ObjectUtils.nullSafeEquals(this.name, ((PropertySource<?>) other).name)));
}
If you are using a library such as jasypt, it's possible that your property source will be a proxy instance and won't actually contain a populated name field. The equals method could use ((PropertySource<?>) other).getName())) which would solve this issue.
MutablePropertySourceshasgetandremovemethods that look like this:These attempt to find the index of a property source index by checking for the name. The
PropertySource.namedmethod returns aComparisonPropertySourcewhich depends on the inheritedPropertySourceequalsandhashCodeimplementations.The equals method looks like this:
If you are using a library such as jasypt, it's possible that your property source will be a proxy instance and won't actually contain a populated
namefield. The equals method could use((PropertySource<?>) other).getName()))which would solve this issue.