소스 검색

商品导入

xujunwei 1 년 전
부모
커밋
a817bcffb4
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      framework-boot/src/main/java/com/mrxu/framework/boot/web/BaseController.java

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

@@ -269,7 +269,7 @@ public class BaseController {
      */
     @SneakyThrows
     protected void downloadFile(HttpServletResponse response,String fileName) {
-        InputStream inputStream = this.getClass().getResourceAsStream("file/"+fileName);
+        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("file/"+fileName);
         byte[] fileByte = IOUtils.toByteArray(inputStream);;
         // 文件转成字节数组
         // 设置response的Header