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();
    }
    }
  • 相关阅读:
    一个完整的AjaxPro例子(转)
    sql2000存储过程
    System.Configuration命名空间下找不到ConfigurationManager类
    编译器错误信息: CS0016
    (转)AjaxPro使用说明
    数据库中去逗号的函数
    asp.net 验证码
    sql2005存储过程
    简单控件分页
    身份证号码验证
  • 原文地址:https://www.cnblogs.com/pxzbky/p/11911322.html
Copyright © 2011-2022 走看看