路径选择

import org.apache.poi.util.IOUtils;   
public void downloadFileMode(HttpServletResponse response) throws IOException {      
      InputStream fis = null;
        ServletOutputStream sos = null;
        try {
            String fileName = "财务预算模版.xlsx";
            //设置响应头
            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
            String path = "/tmp/" + fileName;
            ClassPathResource classPathResource = new ClassPathResource(path);
            fis = classPathResource.getInputStream();
            sos = response.getOutputStream();
            IOUtils.copy(fis, sos);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("模板下载失败!");
        } finally {
            try {
                if (fis != null) {
                    fis.close();
                }
                if (sos != null) {
                    sos.flush();
                    sos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }