博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spring Schedule
阅读量:6957 次
发布时间:2019-06-27

本文共 564 字,大约阅读时间需要 1 分钟。

hot3.png

1.介绍

    作业调度,如定时任务

 

2.Cron表达式

    7个占位符:    秒    分    时        月        年    (年通常省略)

    Seconds, Minutes, Hours, Day-of-Month, Month, Day-of-Week, Year

    2d7ca4ae6e4eac8bfc4c243c87921f121a0.jpg

    d42a2695e8fb59a38d593cf69a4d120864c.jpg

    ac90813578425596c43caefc35121967e08.jpg

    7a37d563c49fecce697c874c8b23e1e36ff.jpg

 

3.Spring Schedule 配置

applicationContext.xml

//task包

 

4.@Scheduled 写上 Cron表达式

@Autowiredprivate IOrderService iOrderService;@Scheduled(cron = "0 */1 * * * ?")//没1分钟(每个1分钟的整数倍)public void closeOrderTaskV1() {    log.info("关闭订单定时任务启动");    int hour = Integer.parseInt(PropertiesUtil.getProperty("close.order.task.time.hour", "2"));    iOrderService.closeOrder(hour);    log.info("关闭订单定时任务结束");}

转载于:https://my.oschina.net/u/2602876/blog/2218759

你可能感兴趣的文章
Go语言编程----文章汇总
查看>>
nginx做反向代理proxy_pass,proxy_redirect的使用
查看>>
Mybatis的整体架构
查看>>
给出两个单词,找到它们的最短距离 (以它们之间隔了多少个单词计数)。
查看>>
NexentaStor 安装篇
查看>>
Graphical installers are not supported by the VM解决办法
查看>>
我的大学之路---2012在迷雾中前进
查看>>
FF下margin不起作用的问题
查看>>
idea 自动导包
查看>>
mysql主从常见问题
查看>>
iOS 截屏
查看>>
Javascript 经典资料分享大家一起顶
查看>>
linux 系统 stty 的使用
查看>>
搭建Web服务器之Step2:VMware下虚拟机NAT联网设置
查看>>
Android 多线AsyncTask详解
查看>>
我的友情链接
查看>>
使用AdminLTE
查看>>
Armstrong数
查看>>
C# StringHelper
查看>>
c++ 植物类 继承多态 菱形继承
查看>>