spring注解配置quartz
常规配置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.
|
spring注解配置quartz的更多相关文章
- 关于Spring注解配置的步骤
今天分享一下 关于Spring注解配置的流程 1 导包:如下图所示 2 书写User和Car类 代码如下 package cn.lijun.bean; public class Car { priv ...
- Spring注解配置和xml配置优缺点比较
Spring注解配置和xml配置优缺点比较 编辑 在昨天发布的文章<spring boot基于注解方式配置datasource>一文中凯哥简单的对xml配置和注解配置进行了比较.然后朋 ...
- spring注解配置实例
在spring中使用注解配置前需要先在配置文件指定需要扫描的包. 通过注解的方式依赖注入,可以不用创建set方法,也不用在xml文件中申明注入关系. 实例结构如下: 整个流程是: 先创建好数据库的表对 ...
- spring注解配置启动过程
最近看起spring源码,突然想知道没有web.xml的配置,spring是怎么通过一个继承于AbstractAnnotationConfigDispatcherServletInitializer的 ...
- 【Spring实战】Spring注解配置工作原理源码解析
一.背景知识 在[Spring实战]Spring容器初始化完成后执行初始化数据方法一文中说要分析其实现原理,于是就从源码中寻找答案,看源码容易跑偏,因此应当有个主线,或者带着问题.目标去看,这样才能最 ...
- Spring注解配置Aop
之前学习了SpringAop的基本原理.http://www.cnblogs.com/expiator/p/7977975.html 现在尝试使用注解来配置SpringAop. Aop,面向切面编程. ...
- 5.spring:注解配置 Bean
在classpath中扫描组件 组键扫描:能够从classpath下自动扫描,侦测和实例化具有特定注解的组件 特定的组件包括: ->@Componment:基于注解,标识一个受Spring管理的 ...
- 【转】【Spring实战】Spring注解配置工作原理源码解析
一.背景知识 在[Spring实战]Spring容器初始化完成后执行初始化数据方法一文中说要分析其实现原理,于是就从源码中寻找答案,看源码容易跑偏,因此应当有个主线,或者带着问题.目标去看,这样才能最 ...
- Spring 注解配置Bean
一.使用注解配置Bean 1.注解 在类定义.方法定义.成员变量定义前使用.其简化<bean>标签,功能同<bean>标签.格式为: @注解标记名. 2.组件扫描 Spring ...
随机推荐
- .Net高级技术——对象序列化
对象序列化 “序列化是将一个对象保存到存储介质上或者将对象进行转换使之能够在网络上传送的行为”.通俗一点的解释,序列化就是把一个对象保存到一个文件或数据库字段中去,反序列化就是从文件或者数据库中取出数 ...
- 为什么说CLR是类型安全的
CLR总是知道托管堆上的对象是什么类型,这是CLR类型安全的前提.托管堆上的每个对象都有一个"类型对象指针",指向托管堆上Type对象的一个实例.我们总是可以通过System.Ob ...
- python文本 字符与字符值转换
python文本 字符与字符值转换 场景: 将字符转换成ascii或者unicode编码 在转换过程中,注意使用ord和chr方法 >>> print(ord('a')) 97 ...
- Selenium2+python自动化56-unittest之断言(assert)
前言 在测试用例中,执行完测试用例后,最后一步是判断测试结果是pass还是fail,自动化测试脚本里面一般把这种生成测试结果的方法称为断言(assert). 用unittest组件测试用例的时候,断言 ...
- utils/CCArmatureDefine
#ifndef __CCARMATUREDEFINE_H__ #define __CCARMATUREDEFINE_H__ //#define _USRDLL 1 #include "coc ...
- jsp数据库连接大全和数据库操作封装到Javabean
一.jsp连接Oracle8/8i/9i数据库(用thin模式) testOracle.jsp如下: <%@ page contentType="text/html;charset=g ...
- 一道面试题:用shell写一个从1加到100的程序
[试题描述] 请用shell写一个简短的程序,实现1+2+...+100的功能. [程序] 方法一: #!/bin/bash ..} do let sum+=$i done echo $sum 方法二 ...
- Makefile 选项 CFLAGS 、LDFLAGS 、LIBS
CFLAGS 表示用于C编译器的选项 CXXFLAGS 表示用于C++编译器的选项 这两个变量实际上涵盖了编译和汇编的两个步骤 CFLAGS:指定头文件(.h)的路径,如:CFLAGS=-I/usr/ ...
- 缓存算法:LRU、LFU、FIFO
LRU全称是Least Recently Used,即最近最久未使用的意思.如果一个数据在最近一段时间没有被访问到,那么在将来它被访问的可能性也很小.也就是说,当限定的空间已存满数据时,应当把最久 ...
- Windows 7系统垃圾清理自写程序
系统清理.bat @echo off color 0a title windows7系统垃圾清理--- echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★ echo ★☆ ★☆ ...