SpringBoot下载文件
String templateFile = "template.xls";
Resource resource = new ClassPathResource(templateFile);
response.setContentType("application/force-download");
response.addHeader("Content-Disposition",
"attachment;fileName=" + templateFile);
IOUtils.copy(resource.getInputStream(),response.getOutputStream());
response.flushBuffer();
还没有评论,来说两句吧...