不要用file 要用inputStream
Resource resource = new ClassPathResource(certPath);
InputStream certStream = resource.getInputStream();
this.certData = new byte[certStream.available()];
certStream.read(this.certData);
如果使用
File sourceFile = resource.getFile();
那么 肯定就会报错
因为你打包的是jar包,jar包里是没有文件系统的
image.png