}
private PropertySources loadPropertySources(String[] locations,
boolean mergeDefaultSources) {
try {
PropertySourcesLoader loader = new PropertySourcesLoader();
for (String location : locations) {
Resource resource = this.resourceLoader.getResource(this.environment
.resolvePlaceholders(location));
String[] profiles = this.environment.getActiveProfiles();
for (int i = profiles.length; i-- > 0;) {
String profile = profiles[i];
loader.load(resource, profile);
}
loader.load(resource);
}
MutablePropertySources loaded = loader.getPropertySources();
if (mergeDefaultSources) {
for (PropertySource<?> propertySource : this.propertySources) {
loaded.addLast(propertySource);
}
}