-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
Avoid duplicate JAR resources in PathMatchingResourcePatternResolver
on MS Windows
#31598
Conversation
@huyachigege Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@huyachigege Thank you for signing the Contributor License Agreement! |
They reference the same underlying resource, but My English is not good, I hope you can understand. |
PathMatchingResourcePatternResolver
Hi @huyachigege, Congratulations on creating your first PR ever! 👍 We'll look into it.
Yes, your explanation is good enough to follow. I edited the text to make it slightly clearer, and hopefully I didn't change the meaning you wished to convey. |
Thanks, that is what I mean. |
|
line 497 will get root resources, it will contain You can try on windows and use properties I just told. |
Hi @huyachigege,
That doesn't map to the current code on the With which version of Spring Framework are you experiencing the duplicates? |
5.3.x,sorry for that Now is 23 clock in china,I need to go to bed. If there are any questions,I will reply tomorrow |
Can you please provide us the exact location pattern you are using? Specifically, what do you have for |
|
Thanks. That helps. Can you please tell us which version of Java and Spring Boot you're using as well? |
OpenJDK-11,SpringBoot 2.6.12. |
Based on that feedback, it appears that we are getting two different roots (
Then, in The |
PathMatchingResourcePatternResolver
PathMatchingResourcePatternResolver
on MS Windows
…indows This commit updates PathMatchingResourcePatternResolver to avoid returning duplicate resources on MS Windows when searching using the `classpath*:` prefix and a wildcard pattern that matches resources which are directly present in a JAR as well as present via classpath manifest entries. See gh-31598 Closes gh-31603 (cherry picked from commit d5874ab)
To avoid duplicate JAR resources on MS Windows.
If you use
mybatis-plus
and yourmapper-locations
starts withclasspath*:
, Spring will find duplicateUrlResource
s for XML files which results in a crash on application startup.Since their
getCleanedUrl
values are different mybatis will throw an exception, even though they represent the same resource.