When loading properties, PropertiesLoaderSupport class logs a warning message "Could not load properties from ...", even though ignoreResourceNotFound is explicitly configured to true. IMO warning level is too much, info would be more appropriate because ignoreResourceNotFound defaults to false, and one has to deliberatly/consciously set it to true.
What does Spring community and Spring committers think about this suggestion?
Here is the relevant code from org.springframework.core.io.support.PropertiesLoad erSupport class ():
Code:protected void loadProperties(Properties props) throws IOException { if (this.locations != null) { for (Resource location : this.locations) { if (logger.isInfoEnabled()) { logger.info("Loading properties file from " + location); } InputStream is = null; try { is = location.getInputStream(); String filename = null; try { filename = location.getFilename(); } catch (IllegalStateException ex) { // resource is not file-based. See SPR-7552. } if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { this.propertiesPersister.loadFromXml(props, is); } else { if (this.fileEncoding != null) { this.propertiesPersister.load(props, new InputStreamReader(is, this.fileEncoding)); } else { this.propertiesPersister.load(props, is); } } } catch (IOException ex) { if (this.ignoreResourceNotFound) { if (logger.isWarnEnabled()) { logger.warn("Could not load properties from " + location + ": " + ex.getMessage()); } } else { throw ex; } } finally { if (is != null) { is.close(); } } } } }


Reply With Quote