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