4
@Scheduled(cron = "0 0 0 * * *")

这将在午夜运行春季计划作业。我如何明确添加该作业应该运行的年份?(我只是想在今年的测试环境中禁用一个工作,所以我想设置2016)。

4

2 回答 2

3

Spring 调度 cron 只接受六个参数:秒、分钟、小时、日、月、工作日。您可以在此处查看文档:https ://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html

于 2020-03-02T16:45:14.797 回答
0

你可以这样提

@Scheduled(cron = "0 15 10 * * ? 2016")     

2016 年每天上午 10:15 开火

完整的参考时间表参考

于 2015-03-02T11:36:53.323 回答