spring注解配置quartz
生活随笔
收集整理的這篇文章主要介紹了
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. |
轉載于:https://www.cnblogs.com/yangzhilong/p/3794864.html
總結
以上是生活随笔為你收集整理的spring注解配置quartz的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NodeJS安装及部署(Linux系统)
- 下一篇: lazzyfu部署