Advertisement

分布式任务调度框架xxl-job

阅读量:

首先,我们来看一个具体的应用情境 :

当前需要实现一个周期性执行的任务,计划采用Spring框架中的定时任务功能进行开发。

复制代码
>       1. @SpringBootApplication

>  
>       2. @EnableScheduling//开启定时任务
>  
>       3. public class TaskApplication {
>  
>       4.  
>  
>       5.     public static void main(String[] args) {
>  
>       6.         SpringApplication.run(TaskApplication.class,args);
>  
>       7.     }
>  
>       8. }
>  
>  
>  
>  
> ```

>
>
复制代码
  1. @Component
复制代码
  2. public class HelloJob {

  3.  

  4.     @Scheduled(cron = "0/2 * * * * ?")//cron表达式定时任务的触发时间

  5.     pu

全部评论 (0)

还没有任何评论哟~