瀏覽代碼

模版下载

xujunwei 1 年之前
父節點
當前提交
fd0ba0423d
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      framework-boot/src/main/java/com/mrxu/framework/boot/web/BaseController.java

+ 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