SpringProperties falls back to ClassLoader.getSystemResource when loaded in bootstrap ClassLoader

Issue: SPR-11721
This commit is contained in:
Juergen Hoeller 2014-04-23 18:18:46 +02:00
parent 794e859e68
commit 9cb5f48459
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ public abstract class SpringProperties {
static {
try {
ClassLoader cl = SpringProperties.class.getClassLoader();
URL url = cl.getResource(PROPERTIES_RESOURCE_LOCATION);
URL url = (cl != null ? cl.getResource(PROPERTIES_RESOURCE_LOCATION) :
ClassLoader.getSystemResource(PROPERTIES_RESOURCE_LOCATION));
if (url != null) {
logger.info("Found 'spring.properties' file in local classpath");
InputStream is = url.openStream();