Consistent ordering for @PropertySource locations

Ensure that property source locations are processed in the same order
regardless if the 'name' attribute is set or not.

Prior to this commit multiple locations from a `@PropertySource` with
a name were added to a `CompositePropertySource` in such a way that
the first location would take precedence. This has now been reversed
for consistence with unnamed `@PropertySource`s

Issue: SPR-10820
This commit is contained in:
Phillip Webb
2013-10-21 12:59:00 -07:00
parent b0ff834ee3
commit e3d3d8cd95
2 changed files with 23 additions and 2 deletions

View File

@@ -320,8 +320,8 @@ class ConfigurationClassParser {
}
else {
CompositePropertySource ps = new CompositePropertySource(name);
for (String location : locations) {
ps.addPropertySource(new ResourcePropertySource(location, classLoader));
for (int i = locations.length - 1; i >= 0; i--) {
ps.addPropertySource(new ResourcePropertySource(locations[i], classLoader));
}
this.propertySources.push(ps);
}