mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Consistent logging in ignoreResourceNotFound scenarios
Issue: SPR-15218
This commit is contained in:
+7
-8
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user