-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Classpath resources not found using layer-tools #42591
Comments
The behavior can be observed without all that copying by leaving out
|
I think this warning applies here (from the JavaDoc of
|
For example this:
doesn't work in the Uber jar and in the extracted version.
works in uber jar and in the extracted version. |
@mhalbritter thank you very much for answering so fast! We are still wondering why using Using
+++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++ Resource: URL [jar:nested:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/boot-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file.avsc]
++++++++++ Resource: URL [jar:nested:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/boot-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file3.avsc]
++++++++++ Resource: URL [jar:nested:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/boot-0.0.1-SNAPSHOT.jar/!BOOT-INF/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file2.avsc]
+++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++ NO RESOURCES FOUND!!!
++++++++++++++++++++++++++++++++++++++++++++++++ I am returning to the results as I think I did not explain myself correctly initially. Note that we are using Regards, |
Maybe someone else from the team knows more about that stuff than I do. But I don't think this is a bug, because it's documented in the JavaDoc warning. But let's see what the rest of the team makes of it. |
It's a bit unfortunate that it works with one form of packaging and not another. It would be interesting to know how the uber jar behaves when using the classic loader. |
Classic one:
Finds the resources, too. |
Thanks, @mhalbritter. This reminds me somewhat of #1744 where running in an IDE behaved one way and running as an uber jar behaved in another way. We decided not to make any changes there as the uber jar's behavior aligned with that of the JDK's jar support. Here we appear to have an uber jar behaving one way and a standard JDK jar behaving in another way. If we were to align the behavior, it'd have to be by changing the uber jar to somehow stop this from working which, while more consistent, feels like a step backwards. |
Debugging this and I think there's a potential enhancement that could be made to
This doesn't actually appear to be the case. The result I see in Looking at |
I'm working on something to submit to Framework. |
Closing in favor of Spring Framework PR spring-projects/spring-framework#33705 |
Context
We are migrating our applications to using layer-tools but we are finding different behaviors in how applications search for classpath resources through the use of the
PathMatchingResourcePatternResolver
class.It seems that the main problem is when using as location pattern an expression starting with wildcards, for example:
classpath*:/**/*.avsc
.We have created a simple application that reproduces the case we are discussing.
Steps to reproduce
cd DemoPathMatchingResourcePatternResolverApplication mvn clean install
Expected outcome
Using as AntPattern path
classpath*:/**/*.avsc
the application finds all the .avsc files that are in the classpath inside the jar resources of theartifact
module:Observed outcome
The application running in layer-tools mode does NOT find the .avsc resources:
Details of tests performed
Versions
Spring-Boot version 3.3.4
The text was updated successfully, but these errors were encountered: