zoukankan      html  css  js  c++  java
  • 定时任务(二)

    package com.sf.dangbao.core.TimeTask;

    import org.quartz.*;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;


    /**
    * @author pxz
    * @date 2019/4/28
    * @description :
    */
    @Configuration
    public class QuartzJobConfig {

    @Value("${send.corn}")
    private String sendTaskJobCorn;

    @Value("${send.tomorrow}")
    private String tomorrowJobCorn;

    @Bean
    public JobDetail distributeTaskJob() {
    return JobBuilder.newJob(DistributeTaskJob.class).withIdentity("distributeTaskJob").storeDurably().build();
    }

    @Bean
    public JobDetail tomorrowTaskJob(){
    return JobBuilder.newJob(TomorrowTaskJob.class).withIdentity("tomorrowTaskJob").storeDurably().build();
    }

    @Bean
    public Trigger storeCheckJobTrigger() {
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(sendTaskJobCorn);
    return TriggerBuilder.newTrigger().forJob(distributeTaskJob()).withIdentity("storeCheckJobTrigger")
    .withSchedule(scheduleBuilder).build();
    }

    @Bean
    public Trigger tomorrowJobTrigger() {
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(tomorrowJobCorn);
    return TriggerBuilder.newTrigger().forJob(tomorrowTaskJob()).withIdentity("tomorrowJobTrigger")
    .withSchedule(scheduleBuilder).build();
    }
    }
  • 相关阅读:
    python总结4
    python中if __name__ == '__main__': 的解析
    matlab学习1
    phpstorm xdebug环境搭建
    uniapp 直播跳转小程序组件
    vue中异步函数async和await的用法
    TFS 2010安装配置(Advance)失败记录
    WIN2003 SMTP Service issue
    WIN2003 ftp server权限设置
    Discuz 7.2 SC UTF8设置
  • 原文地址:https://www.cnblogs.com/pxzbky/p/11911322.html
Copyright © 2011-2022 走看看