文章目录  
 SpringBoot中集成任务调度 1. 任务调度基本介绍 2. corn表达式介绍 2-1 corn的每一个位置功能介绍 2-2 占位符说明 2-3 常用cron举例 3. SpringBoot项目中,集成任务调度@Scheduled 3-1 添加SpringBoot启动依赖 3-2 具体corn任务调度计划 3-3 SpringBoot启动类添加注解@EnableScheduling 4 @Scheduled 其它方式执行任务调度 4-1 fixedDelay 必须是上次调度成功 4-2 fixedRate 无论上次是否会执行成功,下次都会执行 4-3 initialDelay 表示初始化延迟 X 毫秒后,执行具体的任务调度   
 
任务调度器就是按照规定的计划完成任务;
	比如windows, linux的自带的任务调度系统功能;
	平常开发中也就是按照规定的时间点轮询执行计划任务
	(比如每周三的凌晨进行数据备份),
	或者按时间隔触发一次任务调度(比如每3 小时执行一次定时抓拍);
 
 
0  0  3  *  *  ?	每月每天凌晨3 点触发
0  0  3  1  *  ?	每月1 日凌晨3 点触发
0  0  3  ? *  WEN	星期三中午12 点触发
0  0  3  ?*  MON- FRI	周一至周五凌晨3 点触发
0  0 / 5  8  *  *  ?	每天7 点至7 : 55 分每隔5 分钟触发一次
0  10 , 20  8  *  *  ?	每天的8 点10 分,8 点20 分触发
0  0  1 - 3  *  *  ?	每天的1 点至三点每小时触发一次
0  0  8  L  *  ?	每月最后一天的8 点触发
0  10  12  ? *  6 #3 	每月的第三个星期五的12 : 10 分触发
0  10  12  ? *  6L  2022 	表示2022 年每月最后一个星期五10 : 22 分触发
< dependencies> < dependency> < groupId> </ groupId> < artifactId> </ artifactId> </ dependency> </ dependencies> @Service 
public  class  PlainService  { 
    @Scheduled ( cron =  "30 * * * * ?" ) 
    public  void  cronScheduled ( ) { 
        System . out. println ( "测试任务调度内容打印。。。" ) ; 
    } 
} 
@SpringBootApplication 
@EnableScheduling 
public  class  ScheduledApplication  { 
    public  static  void  main ( String [ ]  args)  { 
        SpringApplication . run ( ScheduledApplication . class , args) ; 
    } 
} 
	
   @Scheduled ( fixedDelay =  3000 ) 
    public  void  fixedDelayScheduled ( ) { 
        System . out. println ( "the day nice" ) ; 
    } 
	
    @Scheduled ( initialDelay =  1000 , fixedRate =  3000 ) 
    public  void  initialDelayStringScheduled ( ) { 
        System . out. println ( "the night nice" ) ; 
    } 
	
    @Scheduled ( initialDelay =  1000 , fixedRate =  3000 ) 
    public  void  initialDelayStringScheduled ( ) { 
        System . out. println ( "the night nice" ) ; 
    }