Polishing
Issue: SPR-11637
This commit is contained in:
@@ -305,8 +305,7 @@ class ConfigurationClassParser {
|
||||
String name = propertySource.getString("name");
|
||||
String[] locations = propertySource.getStringArray("value");
|
||||
boolean ignoreResourceNotFound = propertySource.getBoolean("ignoreResourceNotFound");
|
||||
int locationCount = locations.length;
|
||||
if (locationCount == 0) {
|
||||
if (locations.length == 0) {
|
||||
throw new IllegalArgumentException("At least one @PropertySource(value) location is required");
|
||||
}
|
||||
for (String location : locations) {
|
||||
@@ -314,8 +313,7 @@ class ConfigurationClassParser {
|
||||
Resource resource = this.resourceLoader.getResource(
|
||||
this.environment.resolveRequiredPlaceholders(location));
|
||||
if (!StringUtils.hasText(name) || this.propertySources.containsKey(name)) {
|
||||
// We need to ensure unique names when the property source will
|
||||
// ultimately end up in a composite
|
||||
// We need to ensure unique names when the property source will ultimately end up in a composite
|
||||
ResourcePropertySource ps = new ResourcePropertySource(resource);
|
||||
this.propertySources.add((StringUtils.hasText(name) ? name : ps.getName()), ps);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -307,7 +307,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
"Reason: Environment must implement ConfigurableEnvironment");
|
||||
}
|
||||
else {
|
||||
MutablePropertySources envPropertySources = ((ConfigurableEnvironment)this.environment).getPropertySources();
|
||||
MutablePropertySources envPropertySources = ((ConfigurableEnvironment) this.environment).getPropertySources();
|
||||
for (PropertySource<?> propertySource : parsedPropertySources) {
|
||||
envPropertySources.addLast(propertySource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user