-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Affects: spring-core 5.3.18
When looking up a resource that's contained in the root of a dependency jar with a path wildcard, PathMatchingResourcePatternResolver gives different results depending on the way the classpath is given to java.
Taking the JUnit 4 JAR as a readily available example, from what I would expect from the docs,
new PathMatchingResourcePatternResolver().getResources("classpath*:**/LICENSE-junit.txt")
and
getClass().getClassLoader().getResources("LICENSE-junit.txt")
should find the same resource. However, if the java process is called with the classpath given in a JAR file containing the dependency JAR in its manifest, PathMatchingResourcePatternResolver does not find the resource.
See https://github.com/cnaj/path-matching-resource-pattern-resolver-demo for a demo of this behavior.
Please run the two scripts demo-normal-cp.sh and demo-jar-cp.sh in the demo repository to see the difference in behavior.
Tested with Java 8 and Java 11 on Windows, Linux, and Mac.
This behavior has already been reported previously with #24480, but it was apparently mistaken for a VS Code behavior.