spring注解配置quartz
2024-08-29 20:28:12
常规配置quartz可以参考我的另外一篇博文:http://www.cnblogs.com/yangzhilong/p/3349116.html
spring配置文件里增加:
命令空间:
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
配置:
<task:annotation-driven/>
当然这还需要扫描注解等常规配置。
java代码:
package com.test;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; @Component
public class TestJob {
@Scheduled(fixedDelay = 1000)
public void test()
{
System.out.println("job 开始执行");
}
}
Scheduled类的可配置属性项:
String |
cron
A cron-like expression, extending the usual UN*X definition to include triggers on the second as well as minute, hour, day of month, month and day of week.
|
long |
fixedDelay
Execute the annotated method with a fixed period between the end of the last invocation and the start of the next.
|
String |
fixedDelayString
Execute the annotated method with a fixed period between the end of the last invocation and the start of the next.
|
long |
fixedRate
Execute the annotated method with a fixed period between invocations.
|
String |
fixedRateString
Execute the annotated method with a fixed period between invocations.
|
long |
initialDelay
Number of milliseconds to delay before the first execution of a
fixedRate() or fixedDelay() task. |
String |
initialDelayString
Number of milliseconds to delay before the first execution of a
fixedRate() or fixedDelay() task. |
String |
zone
A time zone for which the cron expression will be resolved.
|
最新文章
- LeetCode Find All Duplicates in an Array
- 给定时器settimeout、setInterval调用传递参数
- 51nod 1101换零钱(背包)
- 第1章 认识jQuery
- bean之间的关系:继承、依赖
- Unity3D中Console控制台的扩展
- mysql explain输出中type的取值说明
- OpenCV 连接 Android IP摄像头
- 全国计算机等级考试二级教程-C语言程序设计_第5章_循环结构
- iOS系统自带的 UIAlertView 自动旋转的实现
- Android 修改底部导航栏navigationbar的颜色
- hudson配置教程
- DOM树节点和事件
- 来自projecteuler.net网站的练习题1
- Python 创建递归文件夹
- 让CPU占用率曲线听你指挥
- App Store评论优化,让你的APP评论上涨
- Linux配置JDK、Tomcat和Mysql免安装版
- grid-layout
- pascalcontext-fcn全卷积网络结构理解
热门文章
- How to install WP 8.0 SDK if WP 8.1 SDK is installed?
- MVC自定义路由02-实现IRouteConstraint限制控制器名
- IOS开发之深拷贝与浅拷贝(mutableCopy与Copy)详解
- 使用 NSPropertyListSerialization 持久化字典与数组
- C++ Primer 学习笔记_72_面向对象编程 --句柄类与继承[续]
- C# 编程指南
- Linux C Socket编程发送结构体、文件详解及实例
- Linked List Cycle leetcode java (链表检测环)
- Java基础(五):数组和Java方法
- operator++()和operator++(int)的区别