【发布时间】:2022-01-17 01:31:54
【问题描述】:
在我正在处理的 Spring Batch 应用程序中,我以这种方式安排了工作:
@Scheduled(cron = "0 30 01 * * 7")
public void runUpdateNotaryListInfoJob() {
LOGGER.info("SCHEDULED run of updateNotaryListInfoJob STARTED");
Map<String, JobParameter> confMap = new HashMap<>();
confMap.put("time", new JobParameter(System.currentTimeMillis()));
JobParameters jobParameters = new JobParameters(confMap);
try {
jobLauncher.run(updateNotaryListInfoJob, jobParameters);
}catch (Exception ex){
LOGGER.error(ex.getMessage());
}
}
这很好用,我的工作每周日(第 7 天)晚上 01:30 运行。好的,但现在我的客户要求我在一周内运行两次(同一时间但在两个不同的日子)。是否可以更改之前的 CRON 表达式,以便我的工作在每周三和每周日的 01:30 执行?
【问题讨论】:
标签: java spring spring-boot cron spring-batch