-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Closed as not planned
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix
Description
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
- Download application:
git clone https://github.com/ferblaca/DemoPathMatchingResourcePatternResolverApplication.git
- Compile:
cd DemoPathMatchingResourcePatternResolverApplication
mvn clean install
- Extract the FATJAR with layer-tools and start the application:
cd boot/target
java -Djarmode=tools -jar boot-0.0.1-SNAPSHOT.jar extract --layers --destination extracted
cd extracted/application
mkdir lib
cp ../*/lib/*.jar lib/.
java -jar boot-0.0.1-SNAPSHOT.jar
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 the artifact
module:
+++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++ Resource: URL [jar:file:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/extracted.fer/application/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file.avsc]
++++++++++ Resource: URL [jar:file:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/extracted.fer/application/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file3.avsc]
++++++++++ Resource: URL [jar:file:/home/fbc/workspaces/ferblaca/demoPathMatchingResolver/demoPathMatchingResourcePatternResolver/boot/target/extracted.fer/application/lib/artifact-0.0.1-SNAPSHOT.jar!/demo/statics/avro/file2.avsc]
+++++++++++++++++++++++++++++++++++++++++++++++++
Observed outcome
The application running in layer-tools mode does NOT find the .avsc resources:
+++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++ NO RESOURCES FOUND!!!
++++++++++++++++++++++++++++++++++++++++++++++++
Details of tests performed
Application Type | AntPattern Path | Result |
---|---|---|
FATJAR | classpath*:/**/*.avsc | 🆗 |
LAYER-TOOLS | classpath*:/**/*.avsc | ❌ |
LAYER-TOOLS | classpath*:/demo/**/*.avsc | 🆗 |
Versions
Spring-Boot version 3.3.4
juliojgd
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix