zoukankan      html  css  js  c++  java
  • Springboot创建定时任务(可配置)

    @ApiModel("***定时任务")
    @Component
    @Configuration
    @EnableScheduling
    //@PropertySource("classpath:/***") // 可指定配置文件
    public class MatchOpenCheckScheduledTask { private final Logger log = LoggerFactory.getLogger(this.getClass()); @Scheduled(cron = "${open-check.cron}") public void openCheckTask(){ log.info("执行‘自动匹配开通校验’定时任务开始:" + FlowUtil.getCurrentDate("yyyy-MM-dd HH:mm:ss") ); long startTime = System.currentTimeMillis(); //获取开始时间   /**********************************************************************************************/


      /**********************************************************************************************/

    long endTime = System.currentTimeMillis(); //获取结束时间 log.info("执行‘自动匹配开通校验’定时任务结束:" + FlowUtil.getCurrentDate("yyyy-MM-dd HH:mm:ss") ); log.info("执行时间:"+(endTime - startTime)/1000+" 秒"); }

    在线Cron表达式生成器

        https://cron.qqe2.com/

  • 相关阅读:
    类加载
    LinkedList插入排序实现
    99乘法表
    关于IO流的抽象类
    分解质因数
    Struts2小demo遇到的几个问题
    Tomcat设置欢迎页问题
    数据库迁移
    EF – 1.模式
    正则表达式
  • 原文地址:https://www.cnblogs.com/LittleMaster/p/14162156.html
Copyright © 2011-2022 走看看