I didn't manage to access any classpath files in my spring-boot jar.
I tried the following :
Resource resource = new ClassPathResource("myResourceFile");
But when I tried to read it, I got the following message
it does not reside in the file system: jar:file:/myjar.jar!/BOOT-INF/classes!/myResourceFile
I noticed the 2 exclamation marks. The first is to indicate the resource is inside a jar, but I don't know if the second one (after classes) is involved in my problem.
Thanks for your help.
I use spring-boot 1.4.5 and spring-* 4.3.7.
If you need to load an image from classpath , you can use something like below:
new ClassPathResource("/static/img/logo.png");
Resource Path:
main -> resources -> static.img -> logo.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With