Skip to content

Commit 4d71bfb

Browse files
committed
Merge branch '1.4.x' into 1.5.x
2 parents 6d8846d + 4b1e5e9 commit 4d71bfb

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,7 @@ private void onApplicationPreparedEvent(ApplicationEvent event) {
211211
protected void addPropertySources(ConfigurableEnvironment environment,
212212
ResourceLoader resourceLoader) {
213213
RandomValuePropertySource.addToEnvironment(environment);
214-
try {
215-
new Loader(environment, resourceLoader).load();
216-
}
217-
catch (IOException ex) {
218-
throw new IllegalStateException("Unable to load configuration files", ex);
219-
}
214+
new Loader(environment, resourceLoader).load();
220215
}
221216

222217
/**
@@ -342,7 +337,7 @@ private class Loader {
342337
: resourceLoader;
343338
}
344339

345-
public void load() throws IOException {
340+
public void load() {
346341
this.propertiesLoader = new PropertySourcesLoader();
347342
this.activatedProfiles = false;
348343
this.profiles = Collections.asLifoQueue(new LinkedList<Profile>());
@@ -430,8 +425,7 @@ private List<Profile> getUnprocessedActiveProfiles(
430425
return unprocessedActiveProfiles;
431426
}
432427

433-
private void load(String location, String name, Profile profile)
434-
throws IOException {
428+
private void load(String location, String name, Profile profile) {
435429
String group = "profile=" + (profile == null ? "" : profile);
436430
if (!StringUtils.hasText(name)) {
437431
// Try to load directly from the location
@@ -463,6 +457,18 @@ private void load(String location, String name, Profile profile)
463457
}
464458

465459
private PropertySource<?> loadIntoGroup(String identifier, String location,
460+
Profile profile) {
461+
try {
462+
return doLoadIntoGroup(identifier, location, profile);
463+
}
464+
catch (Exception ex) {
465+
throw new IllegalStateException(
466+
"Failed to load property source from location '" + location + "'",
467+
ex);
468+
}
469+
}
470+
471+
private PropertySource<?> doLoadIntoGroup(String identifier, String location,
466472
Profile profile) throws IOException {
467473
Resource resource = this.resourceLoader.getResource(location);
468474
PropertySource<?> propertySource = null;

0 commit comments

Comments
 (0)