-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Affects: Spring Framework 5.2.2
When trying to find a class from the class path using PathMatchingResourcePatternResolver you will not find the class if your search pattern starts with classpath*:**/ and your are running your application with a single JAR containing a MANIFEST.MF with Class-path that defines the class path.
For instance, com.vaadin/flow-server contains a class named Tag in the com.vaadin.flow.component package. If you do
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
for (Resource res : resolver.getResources("classpath*:**/component/Tag.class")) {
System.out.println(res);
}
and run the application through VS Code, which happens to use the manifest based class path approach, there are no matches. On the other hand if you run with a "normal" classpath, a URL for the Tag.class will be printed
If you change the pattern to be classpath*:com/**/component/Tag.class i.e. let it start with com/, then both ways of running the application outputs the Tag.class URL.
Example project based on Spring Boot here: https://github.com/Artur-/PathMatchingResourcePatternResolver-jarmanifest