スケジュールされている関数内で HttpServletRequest を初期化し、cron ジョブに従ってアクションを実行しようとしています。しかし、リクエストを初期化した後に機能が停止しました。私は今どうすればいい ?私は春の mvc に取り組んでいます。この私のコード:
@Scheduled(cron = "0 0 1 * * ?")
@Async
public void PerformActionFunction() throws NoSuchAlgorithmException, ParseException {
System.out.println("hello 1");
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
System.out.println("hello 2");
ModelMap model = new ModelMap();
FunctionForDate(request,model);
}
出力には hello 1 が出力されますが、 hello 2 は出力されません。HttpServletRequest を初期化した後に関数が停止しました。私は今どうすればいい 。