springboot 获取resource文件下的图片路径 String path = new ClassPathResource(“static/images/logo.png”, PDFUtil.class.getClassLoader()).getFile().getPath(); 注意:“static/images/logo.png” 这是图片在resource下的路劲, PDFUtil 只是我所写的当前的类,往PDFUtil类里写了个方法里面需要添加图片 根据自己需求换你当前用到的类