private File getFile(String path, String ext) {
ClassPathResource classPathResource = new ClassPathResource("file/video/replace.mp4");
InputStream stream = classPathResource.getStream();
return FileUtil.writeFromStream(stream, FileUtils.getFilepath("", ext));
}
不能直接使用classPathResource.getFile()来获取文件
SpringBoot打成jar包执行的时候,必须要使用流的方式来读取!