1、方式一
问题:本地正常,但打jar包运行无法获取图片
String path = GetResource.class.getClassLoader().getResource("/static/resources/images/20210703.png").getPath();
Image img = Image.getInstance(path);
2、方式二:本地正常,打jar包运行也正常了
String imgName = "/static/resources/images/20210703.png";
ClassPathResource classPathResource = new ClassPathResource(imgName);
byte[] path = FileCopyUtils.copyToByteArray(classPathResource.getInputStream());
Image img = Image.getInstance(path);