Closed
Description
PropertySourcesPropertyValues.processPropertySource
does the following:
private void processPropertySource(PropertySource<?> source,
PropertySourcesPropertyResolver resolver,
PropertyNamePatternsMatcher includes, Collection<String> exacts) {
if (source instanceof EnumerablePropertySource) {
processEnumerablePropertySource((EnumerablePropertySource<?>) source,
resolver, includes, exacts);
}
else if (source instanceof CompositePropertySource) {
processCompositePropertySource((CompositePropertySource) source, resolver,
includes, exacts);
}
else {
// We can only do exact matches for non-enumerable property names, but
// that's better than nothing...
processDefaultPropertySource(source, resolver, includes, exacts);
}
}
Since Spring 4.1.2, CompositePropertySource
extends EnumerablePropertySource
.
There are two issues with it:
- The second branch of the condition (first "else") is never executed (dead code).
CompositePropertySource
does not actually fulfil the specification ofEnumerablePropertySource
. It may contain a non-enumerable property source in which casegetPropertyNames
does not in fact list all the properties.
The latter is arguably an issue in Spring core. But it has negative effect on Spring Boot as well, so it probably should be fixed in the core or worked around in Boot.