Browse Source

模版下载

xujunwei 1 year atrás
parent
commit
fd0ba0423d

+ 2 - 1
framework-boot/src/main/java/com/mrxu/framework/boot/web/BaseController.java

@@ -269,7 +269,8 @@ public class BaseController {
      */
     @SneakyThrows
     protected void downloadFile(HttpServletResponse response,String fileName) {
-        File file = ResourceUtils.getFile("classpath:file/"+fileName);
+        String path = this.getClass().getClassLoader().getResource("").getPath();
+        File file = new File(path + "file/"+fileName);
         // 文件转成字节数组
         byte[] fileByte = Files.readAllBytes(file.toPath());
         // 设置response的Header