1、@EnableScheduling
spring自带的定时任务功能,使用比较简单方便:
 1、需要定时执行的方法上加上@Scheduled注解,这个注解中可以指定定时执行的规则,稍后详细介绍。
2、Spring容器中使用@EnableScheduling开启定时任务的执行,此时spring容器才可以识别@Scheduled标注的方法,然后自动定时执行。
示例代码如下:
 SchedulingSynWqs类
@Configuration
@EnableScheduling
public class SchedulingSynWqs {
    @Autowired
    private Min05Vdr00AslService min05Vdr00AslService;
    @Autowired
    private Mid04Vdr01QyItfService mid04Vdr01QyItfService;
    @Autowired
    private SupplyStraightWqsItfService supplyStraightWqsItfService;
    @Autowired
    private RectificationPlanMainQualityParentItfService rectificationPlanMainQualityParentItfService;
    @Autowired
    private RectificationPlanMainQualityChildItfService rectificationPlanMainQualityChildItfService;
    @Autowired
    private RectificationPlanMainQualityParentService rectificationPlanMainQualityParentService;
    /**
     * 同步批准供方列表传wqs
     */
    @Scheduled(cron = "0 */30 * * * ?")
    public void synWqs() {
        System.out.println("每5分钟调用一次wqs" + new Date());
        min05Vdr00AslService.synWqsData();
    }
}
定时规则配置通过cron传参实现,具体解释可以参考这篇博客
2、quartz包
详细了解可以参考这篇博客
 
 schedule_job_log表 :定时任务执行日志
 schedule_job表:定时任务参数
 qrtz_cron_triggers :定时任务cron信息
 qrtz_job_details :
 还有qrtz_triggers 、qrtz_scheduler_state等表
未完待续…



![洛谷 P1216 [USACO1.5] [IOI1994]数字三角形题解](https://img-blog.csdnimg.cn/6744dd4a7e5a4921b44b637a4122c13f.png)















