Consistent logging in ignoreResourceNotFound scenarios

Issue: SPR-15218
(cherry picked from commit 448ea4c)
This commit is contained in:
Juergen Hoeller
2017-02-10 10:41:10 +01:00
parent 941f3e7166
commit d6216fb74a
4 changed files with 31 additions and 20 deletions

View File

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