定义定时任务-@EnableScheduling
作者:
泠泉 | 来源:发表于
2019-03-15 17:33 被阅读0次@Configuration
@EnableScheduling
@Slf4j
public class SchedulingConfig {
@Autowired
private IAgreementService agreementService;
@Scheduled(cron = "*/5 * * * * ?") // 测试(每隔5秒)
public void test() {
log.info("开始执行测试任务>>>");
}
@Scheduled(cron = "0 0 1 * * ?") // 检查、更新合同状态(每天凌晨1点)
public void endExpiredSalesAgreeement() {
log.info("开始执行检查、更新合同状态>>>");
agreementService.checkPassedAgreement();
}
}
本文标题:定义定时任务-@EnableScheduling
本文链接:https://www.haomeiwen.com/subject/niurmqtx.html
网友评论