Spring Boot – Reading Text File using ResourceLoader

I have checked your code.If you would like to load a file from classpath in a Spring Boot JAR, then you have to use the resource.getInputStream() rather than resource.getFile().If you try to use resource.getFile() you will receive an error, because Spring tries to access a file system path, but it can not access a path in your JAR.

detail as below:

https://smarterco.de/java-load-file-classpath-spring-boot/

Leave a Comment