Commit 4d71bfbf authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '1.4.x' into 1.5.x

parents 6d8846d9 4b1e5e9c
...@@ -211,12 +211,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, ...@@ -211,12 +211,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
protected void addPropertySources(ConfigurableEnvironment environment, protected void addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader) { ResourceLoader resourceLoader) {
RandomValuePropertySource.addToEnvironment(environment); RandomValuePropertySource.addToEnvironment(environment);
try { new Loader(environment, resourceLoader).load();
new Loader(environment, resourceLoader).load();
}
catch (IOException ex) {
throw new IllegalStateException("Unable to load configuration files", ex);
}
} }
/** /**
...@@ -342,7 +337,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, ...@@ -342,7 +337,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
: resourceLoader; : resourceLoader;
} }
public void load() throws IOException { public void load() {
this.propertiesLoader = new PropertySourcesLoader(); this.propertiesLoader = new PropertySourcesLoader();
this.activatedProfiles = false; this.activatedProfiles = false;
this.profiles = Collections.asLifoQueue(new LinkedList<Profile>()); this.profiles = Collections.asLifoQueue(new LinkedList<Profile>());
...@@ -430,8 +425,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, ...@@ -430,8 +425,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
return unprocessedActiveProfiles; return unprocessedActiveProfiles;
} }
private void load(String location, String name, Profile profile) private void load(String location, String name, Profile profile) {
throws IOException {
String group = "profile=" + (profile == null ? "" : profile); String group = "profile=" + (profile == null ? "" : profile);
if (!StringUtils.hasText(name)) { if (!StringUtils.hasText(name)) {
// Try to load directly from the location // Try to load directly from the location
...@@ -463,6 +457,18 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, ...@@ -463,6 +457,18 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
} }
private PropertySource<?> loadIntoGroup(String identifier, String location, private PropertySource<?> loadIntoGroup(String identifier, String location,
Profile profile) {
try {
return doLoadIntoGroup(identifier, location, profile);
}
catch (Exception ex) {
throw new IllegalStateException(
"Failed to load property source from location '" + location + "'",
ex);
}
}
private PropertySource<?> doLoadIntoGroup(String identifier, String location,
Profile profile) throws IOException { Profile profile) throws IOException {
Resource resource = this.resourceLoader.getResource(location); Resource resource = this.resourceLoader.getResource(location);
PropertySource<?> propertySource = null; PropertySource<?> propertySource = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment