get请求下载文件
@GetMapping("app") public void app(HttpServletResponse response) throws IOException { ServletOutputStream out = null; ClassPathResource classPathResource = new ClassPathResource("document/scyf.apk"); InputStream in = classPathResource.getInputStream(); response.setContentType("application/octet-stream"); response.addHeader("Content-Disposition", "attachment; filename=\"scyf.apk\""); out = response.getOutputStream(); int len = 0; byte[] buffer = new byte[1024 * 10]; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } out.flush(); out.close(); in.close(); }