zoukankan      html  css  js  c++  java
  • SpringBoot定时任务

    spring定时任务
    TaskScheduler 任务调度者
    TaskExecutor  任务执行者
    
    @EnableScheduling //开启定时功能的注解
    @Scheduled //什么时候执行
    
    Cron表达式

    1、使用方式 开启定时功能注解,在启动类上

    2、将类对象添加到Spring容器中后在定时执行的方法上添加@Scheduled 注解,并写好Cron表达式说明执行时间

    //在特定时间执行这个方法   Timer
        //秒 分 时 日 月 星期
        @Scheduled(cron = "0 39 * * * ?")
        public void hello(){
            System.out.println("hello 执行了");
        }

    常用Cron表达式:https://www.cnblogs.com/junrong624/p/4239517.html

    Cron表达式在线生成:https://www.bejson.com/othertools/cron/

  • 相关阅读:
    结构~函数~输入输出
    常用缀名
    结构
    枚举
    int argc char*argv[]
    字符串的操作
    字符串函数#include<string.h>
    指针的应用
    2019.1.25~2019.1.30学习总结
    v-for
  • 原文地址:https://www.cnblogs.com/harriets-zhang/p/14502582.html
Copyright © 2011-2022 走看看