UnknownHostException as resource-not-found for properties files

Plus first-class declaration of FileNotFoundException in Resource javadoc.

Issue: SPR-15433
This commit is contained in:
Juergen Hoeller
2017-04-11 11:45:30 +02:00
parent ce4eff321c
commit c4e0d6c2a2
4 changed files with 18 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.context.annotation;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
@@ -442,7 +443,7 @@ class ConfigurationClassParser {
Resource resource = this.resourceLoader.getResource(resolvedLocation);
addPropertySource(factory.createPropertySource(name, new EncodedResource(resource, encoding)));
}
catch (IllegalArgumentException | FileNotFoundException ex) {
catch (IllegalArgumentException | FileNotFoundException | UnknownHostException ex) {
// Placeholders not resolvable or resource not found when trying to open it
if (ignoreResourceNotFound) {
if (logger.isInfoEnabled()) {