PathMatchingResourcePatternResolver tries all root URLs (any file extension) as jar file
Issue: SPR-14936
This commit is contained in:
parent
89802cfc11
commit
b3e94dc747
|
@ -365,7 +365,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
if (classLoader instanceof URLClassLoader) {
|
if (classLoader instanceof URLClassLoader) {
|
||||||
try {
|
try {
|
||||||
for (URL url : ((URLClassLoader) classLoader).getURLs()) {
|
for (URL url : ((URLClassLoader) classLoader).getURLs()) {
|
||||||
if (ResourceUtils.isJarFileURL(url)) {
|
|
||||||
try {
|
try {
|
||||||
UrlResource jarResource = new UrlResource(
|
UrlResource jarResource = new UrlResource(
|
||||||
ResourceUtils.JAR_URL_PREFIX + url.toString() + ResourceUtils.JAR_URL_SEPARATOR);
|
ResourceUtils.JAR_URL_PREFIX + url.toString() + ResourceUtils.JAR_URL_SEPARATOR);
|
||||||
|
@ -381,7 +380,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Cannot introspect jar files since ClassLoader [" + classLoader +
|
logger.debug("Cannot introspect jar files since ClassLoader [" + classLoader +
|
||||||
|
@ -421,7 +419,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
for (String path : StringUtils.delimitedListToStringArray(
|
for (String path : StringUtils.delimitedListToStringArray(
|
||||||
javaClassPathProperty, System.getProperty("path.separator"))) {
|
javaClassPathProperty, System.getProperty("path.separator"))) {
|
||||||
try {
|
try {
|
||||||
if (path.endsWith(ResourceUtils.JAR_FILE_EXTENSION)) {
|
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
UrlResource jarResource = new UrlResource(ResourceUtils.JAR_URL_PREFIX +
|
UrlResource jarResource = new UrlResource(ResourceUtils.JAR_URL_PREFIX +
|
||||||
ResourceUtils.FILE_URL_PREFIX + file.getAbsolutePath() +
|
ResourceUtils.FILE_URL_PREFIX + file.getAbsolutePath() +
|
||||||
|
@ -430,7 +427,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
result.add(jarResource);
|
result.add(jarResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (MalformedURLException ex) {
|
catch (MalformedURLException ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Cannot search for matching files underneath [" + path +
|
logger.debug("Cannot search for matching files underneath [" + path +
|
||||||
|
|
Loading…
Reference in New Issue