我在modelandview表单下返回一个api的结果,它基本上是一个excel文件。由于这个api的处理时间很长,我想在线程的帮助下在后台移动处理“进程”。有没有什么方法可以帮我重写这个控制器方法,以便激活执行处理的后台线程?非常感谢。
我的控制器类如下所示:
@RestController
@RequestMapping("/api/background")
public class BackgroundController {
private final BackgroundService backgroundService;
public BackgroundController(BackgroundService backgroundService) {
this.backgroundService = backgroundService;
}
@ApiOperation("Get excel file from processing")
@GetMapping("/headers/export-excel")
private ModelAndView getExcelFile(Principal principal,
@RequestParam(name = "reqId", required = false) BigDecimal reqId) {
return new ModelAndView(new ExcelView(), ExcelView.EXPORT_LIST_NAME, backgroundService.getExcelFile(reqId));
}
}
暂无答案!
目前还没有任何答案,快来回答吧!