Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathMatchingResourcePatternResolver cannot search for "classpath*" patterns in a jar file roots [SPR-12095] #16711

Closed
spring-projects-issues opened this issue Aug 18, 2014 · 1 comment
Assignees
Labels
type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 18, 2014

Phil Webb opened SPR-12095 and commented

When using the PathMatchingResourcePatternResolver against a standard URLClassLoader patterns of the form classpath*:somefile*.properties will not pick up resources from JAR files.

This is due to findAllClassPathResources calling ClassLoader.getResources("") which unfortunately doesn't seem to include JAR URLs in the result.

Spring Boot encountered this issue and created a workaround in commit eb721b1e which might be generally applicable.


Affects: 4.0.6

Reference URL: spring-projects/spring-boot#1378

Issue Links:

  • #17521 Regression: DLL handled as classpath resource
  • #10961 PathMatchingResourcePatternResolver should close jar file from JarURLConnection if not cached
  • #18260 PathMatchingResourcePatternResolver does not consider manifest based classpaths

Referenced from: commits spring-projects/spring-boot@650e326

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 19, 2014

Juergen Hoeller commented

I've added this for 4.1 GA in a slightly revised fashion. Phil Webb, you might want to use UrlResource.exists() in your workaround subclass as well instead of a dangling URL.openConnection() call (which may leave files open in the file system until the VM shuts down).

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants