导出静态的资源文件

    @GetMapping("/exportBaseHonorUser")
    public void exportBaseHonorUser(HttpServletResponse response) throws Exception {
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        response.setCharacterEncoding("utf-8");
        response.addHeader("Content-Disposition", "attachment;filename=honor_base_user.xlsx");
        ClassPathResource classPathResourceSimple = new ClassPathResource("/excel/honor_base_user.xlsx");
        try (InputStream is = classPathResourceSimple.getInputStream()) {
            IOUtils.copy(is, response.getOutputStream());
        }
        response.flushBuffer();
    }
  

 

你可能感兴趣的:(JavaScript,JAVA)