Further refine property source ordering

Refine property source ordering so that sources already contained in the
environment remain before those added by @PropertySource annotations.

Issue: SPR-12198
This commit is contained in:
Phillip Webb
2014-09-19 00:07:30 -07:00
parent e71fbb9f46
commit a2b983a4e4
2 changed files with 17 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ class ConfigurationClassParser {
private final Map<String, ConfigurationClass> knownSuperclasses = new HashMap<String, ConfigurationClass>();
private final Set<String> propertySourceNames = new LinkedHashSet<String>();
private final List<String> propertySourceNames = new ArrayList<String>();
private final ImportStack importStack = new ImportStack();
@@ -375,7 +375,8 @@ class ConfigurationClassParser {
propertySources.addLast(propertySource);
}
else {
propertySources.addFirst(propertySource);
String firstProcessed = this.propertySourceNames.get(this.propertySourceNames.size()-1);
propertySources.addBefore(firstProcessed, propertySource);
}
}
this.propertySourceNames.add(name);