Я хочу переписать устаревший код при весенней загрузке.При попадании в api файл excel в ресурсе должен быть загружен.Ниже приведена часть кода MVC с использованием сервлета JSP.
@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
public void doDownload(HttpSession session,
HttpServletResponse response) throws IOException {
String fn = "/resources/files/censusTemplates";
try {
InputStream inputStream = servletContext.getResourceAsStream(fn);
response.setContentType("application/xlsx");
response.setHeader("Content-Disposition", "attachment; filename=SimpleStandardTemplate.xlsm");
FileCopyUtils.copy(inputStream, response.getOutputStream());
inputStream.close();
} catch (Exception e) {
logger.debug("An error occurred while trying to downloadTemplate: {}", e.getMessage());
}
}
Пожалуйста, помогите мне реализовать загрузку Spring.