Description
Phil Webb opened SPR-13685 and commented
The PathMatchingResourcePatternResolver
has a addAllClassLoaderJarRoots
method which is used to find jar files on the classpath. The current implementation uses URLClassLoader.getURLs()
to find items.
Unfortunately, it appears that URLClassLoader.getURLs()
doesn't include elements that were added to the classpath in META-INF/MANIFEST.MF
but not passed to java -cp
. As Maven uses this technique to launch tests, it's pretty easy to get into a situation where tests fail but production code works.
This bug was originally raised in spring-projects/spring-boot#4438 and a repro project is included https://github.com/MichaelF25/spring-boot-messagesource-bug
Affects: 4.2.2
Issue Links:
- PathMatchingResourcePatternResolver cannot search for "classpath*" patterns in a jar file roots [SPR-12095] #16711 PathMatchingResourcePatternResolver cannot search for "classpath*" patterns in a jar file roots
- Provide subclassing hooks in PathMatchingResourcePatternResolver [SPR-12231] #16846 Provide subclassing hooks in PathMatchingResourcePatternResolver
- PathMatchingResourcePatternResolver provides duplicate resources with relative URL [SPR-14934] #19501 PathMatchingResourcePatternResolver provides duplicate resources with relative URL
PathMatchingResourcePatternResolver
provides duplicate resources when usingclasspath*:
prefix combined with ant-style [SPR-15989] #20539 PathMatchingResourcePatternResolver provides duplicate resources when using classpath* prefix combined with ant-stylePathMatchingResourcePatternResolver
returns duplicate resources when usingclasspath*:
prefix [SPR-16117] #20665 PathMatchingResourcePatternResolver returns duplicate resources when using classpath* prefix- PathMatchingResourcePatternResolver should enforce consistent alphabetical sorting of directory content [SPR-14085] #18657 PathMatchingResourcePatternResolver should enforce consistent alphabetical sorting of directory content
- PathMatchingResourcePatternResolver should close jar file from JarURLConnection if not cached [SPR-6295] #10961 PathMatchingResourcePatternResolver should close jar file from JarURLConnection if not cached
Referenced from: commits 08748ec
0 votes, 6 watchers