【SpringBoot】Windows 和 Linux 环境下文
2021-09-08 本文已影响0人
卓灬不凡
问题
- SpringBoot 被打成 jar 包后,无法直接获取压缩包中的文件,只能通过流的方式获取文件内容
解决
- ClassPathResource
InputStream is = new ClassPathResource("/static/xxx.png").getInputStream();
InputStream is = new ClassPathResource("/static/xxx.png").getInputStream();