diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index be2bcb9e1e..bbb87e250e 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -35,7 +35,6 @@ import java.util.jar.JarFile; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; @@ -317,9 +316,19 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol // We need to have pointers to each of the jar files on the classpath as well... addAllClassLoaderJarRoots(cl, result); } + postProcessFindAllClassPathResourcesResult(location, result); return result.toArray(new Resource[result.size()]); } + /** + * Subclass hook allowing for post processing of a + * {@link #findAllClassPathResources(String) findAllClassPathResources} result. + * @param location the absolute path within the classpath + * @param result a mutable set of the results which can be post processed + */ + protected void postProcessFindAllClassPathResourcesResult(String location, Set result) { + } + /** * Convert the given URL as returned from the ClassLoader into a {@link Resource}. *

The default implementation simply creates a {@link UrlResource} instance. @@ -338,7 +347,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol * @param classLoader the ClassLoader to search (including its ancestors) * @param result the set of resources to add jar roots to */ - private void addAllClassLoaderJarRoots(ClassLoader classLoader, Set result) { + protected void addAllClassLoaderJarRoots(ClassLoader classLoader, Set result) { if (classLoader instanceof URLClassLoader) { try { for (URL url : ((URLClassLoader) classLoader).getURLs()) {