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