码迷,mamicode.com
首页 > 编程语言 > 详细

spring注解配置quartz

时间:2014-06-21 11:32:46      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   java   http   

常规配置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,布布扣,bubuko.com

spring注解配置quartz

标签:style   class   blog   code   java   http   

原文地址:http://www.cnblogs.com/yangzhilong/p/3794864.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!