如何仅在特定年份运行春季计划的工作?

问题描述 投票:3回答:3
@Scheduled(cron = "0 0 0 * * *")

这将在午夜执行春季预定的工作。我该如何在该工作应该执行的年份添加专案? (我只想今年禁用测试环境中的工作,所以我想设置2016年。)>

@@ Scheduled(cron =“ 0 0 0 * * *”)这将在午夜运行春季计划的作业。我该如何在该工作应该执行的年份添加专案? (我只想为此禁用测试环境中的工作...

java spring spring-scheduled
3个回答
0
投票

您可以通过这种方式提及它


0
投票
@Scheduled(cron = "0 0 0 * * * 2016")

0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.