springBoot项目打成的jar包无法获取resources下文件

错误:

cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/U

spring boot项目打成的 jar包无法获取src/main/resources下文件


打成Jar后

获取resources下的文件

1
2
3
ClassPathResource classPathResource = new ClassPathResource("img/tofflon-logo.png");
URL url = classPathResource.getURL();
Image image = Image.getInstance(url);

-------------本文结束感谢您的阅读-------------