【发布时间】:2020-06-25 00:36:57
【问题描述】:
我的作业在指定的时间运行,但它在指定的时间每秒运行一次,例如,如果我将作业设置为在 22:54 运行,它将从 22:54:00 到 22:54 每秒运行一次: 59.我希望它在指定的时间只运行一次......非常感谢任何帮助
我的代码:
@Scheduled(cron = "* 54 22 * * ?")
public void getCompaniess() {
System.out.println(new Date()+" > Running testScheduledMethod...");
}
输出:
Thu Mar 12 22:54:00 GMT 2020 > Running testScheduledMethod...
Thu Mar 12 22:54:01 GMT 2020 > Running testScheduledMethod...
.....
Thu Mar 12 22:54:59 GMT 2020 > Running testScheduledMethod...
【问题讨论】:
标签: spring-boot cron spring-scheduled