Affects: org.springframework.boot version 2.5.9
org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(...) is not working properly with Java-17 or 16
Exception in thread "main" java.lang.RuntimeException: Unable to get URL from application.properties: Invalid URI [jar:file:C:\work\DEMO\demo-0.0.1-SNAPSHOT\lib\demo-0.0.1-SNAPSHOT-plain.jar!/application.properties]; nested exception is java.net.URISyntaxException: Illegal character in opaque part at index 11: jar:file:C:\work\DEMO\demo-0.0.1-SNAPSHOT\lib\demo-0.0.1-SNAPSHOT-plain.jar!/application.properties
Java-17 path : jar:file:C:\work\DEMO\demo-0.0.1-SNAPSHOT\lib\demo-0.0.1-SNAPSHOT-plain.jar!/application.properties
Java-8 path : file:/C:/work/DEMO/demo-0.0.1-SNAPSHOT/lib/demo-0.0.1-SNAPSHOT-plain.jar!/application.properties
it looks like the path is not correct with java-17 and it is working fine with Java-8, could you please help with this issue?
PFA. demo.zip demo-0.0.1-SNAPSHOT.zip
Thanks, -Himanshu K.
Comment From: PC-Chiu
In my case, it happens on Microsoft Windows, use IDE run app, JDK11+ and match pattern like classpath*:**/application.properties
, not on macOS、run with spring boot jar、match pattern not include **
Comment From: snicoll
I don't have Windows handy but I think this has been fixed in the meantime. Would you be able to run your demo again with a supported Spring version please?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.