Process CompositePropertySources before EnumerablePropertySources
PropertySourcePropertyValues tries to process a PropertySource first as an EnumerablePropertySource and then as a CompositePropertySource. In Spring 4.1.2 CompositePropertySource was updated to extend EnumerablePropertySource. This change meant that a CompositePropertySource would always be processed as an EnumerablePropertySource. This commit updates PropertySourcePropertyValues to process a PropertySource as a CompositePropertySource first and to then try it is an EnumerablePropertySource. Fixes gh-2608
This commit is contained in:
parent
f1ecf53495
commit
fc4376145c
|
@ -98,14 +98,14 @@ public class PropertySourcesPropertyValues implements PropertyValues {
|
||||||
private void processPropertySource(PropertySource<?> source,
|
private void processPropertySource(PropertySource<?> source,
|
||||||
PropertySourcesPropertyResolver resolver,
|
PropertySourcesPropertyResolver resolver,
|
||||||
PropertyNamePatternsMatcher includes, Collection<String> exacts) {
|
PropertyNamePatternsMatcher includes, Collection<String> exacts) {
|
||||||
if (source instanceof EnumerablePropertySource) {
|
if (source instanceof CompositePropertySource) {
|
||||||
processEnumerablePropertySource((EnumerablePropertySource<?>) source,
|
|
||||||
resolver, includes, exacts);
|
|
||||||
}
|
|
||||||
else if (source instanceof CompositePropertySource) {
|
|
||||||
processCompositePropertySource((CompositePropertySource) source, resolver,
|
processCompositePropertySource((CompositePropertySource) source, resolver,
|
||||||
includes, exacts);
|
includes, exacts);
|
||||||
}
|
}
|
||||||
|
else if (source instanceof EnumerablePropertySource) {
|
||||||
|
processEnumerablePropertySource((EnumerablePropertySource<?>) source,
|
||||||
|
resolver, includes);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// We can only do exact matches for non-enumerable property names, but
|
// We can only do exact matches for non-enumerable property names, but
|
||||||
// that's better than nothing...
|
// that's better than nothing...
|
||||||
|
@ -114,8 +114,7 @@ public class PropertySourcesPropertyValues implements PropertyValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processEnumerablePropertySource(EnumerablePropertySource<?> source,
|
private void processEnumerablePropertySource(EnumerablePropertySource<?> source,
|
||||||
PropertySourcesPropertyResolver resolver,
|
PropertySourcesPropertyResolver resolver, PropertyNamePatternsMatcher includes) {
|
||||||
PropertyNamePatternsMatcher includes, Collection<String> exacts) {
|
|
||||||
if (source.getPropertyNames().length > 0) {
|
if (source.getPropertyNames().length > 0) {
|
||||||
for (String propertyName : source.getPropertyNames()) {
|
for (String propertyName : source.getPropertyNames()) {
|
||||||
if (PropertySourcesPropertyValues.PATTERN_MATCHED_PROPERTY_SOURCES
|
if (PropertySourcesPropertyValues.PATTERN_MATCHED_PROPERTY_SOURCES
|
||||||
|
|
Loading…
Reference in New Issue