Consistent logging in ignoreResourceNotFound scenarios

Issue: SPR-15218
This commit is contained in:
Juergen Hoeller
2017-02-10 10:41:10 +01:00
parent b630c9bea7
commit 448ea4cdfe
4 changed files with 23 additions and 30 deletions

View File

@@ -417,15 +417,14 @@ class ConfigurationClassParser {
Resource resource = this.resourceLoader.getResource(resolvedLocation);
addPropertySource(factory.createPropertySource(name, new EncodedResource(resource, encoding)));
}
catch (IllegalArgumentException ex) {
// from resolveRequiredPlaceholders
if (!ignoreResourceNotFound) {
throw ex;
catch (IllegalArgumentException | FileNotFoundException ex) {
// Placeholders not resolvable or resource not found when trying to open it
if (ignoreResourceNotFound) {
if (logger.isInfoEnabled()) {
logger.info("Properties location [" + location + "] not resolvable: " + ex.getMessage());
}
}
}
catch (FileNotFoundException ex) {
// from ResourcePropertySource constructor
if (!ignoreResourceNotFound) {
else {
throw ex;
}
}