大雨大雨
BlogJava
::
首頁
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
posts - 4, comments - 1, trackbacks - 0
<
2013年5月
>
日
一
二
三
四
五
六
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
給我留言
查看公開留言
查看私人留言
隨筆分類
(3)
JAVA(3)
隨筆檔案
(4)
2013年5月 (4)
搜索
最新評論
1.?re: [原創(chuàng)]slf4j+logback 多個日志輸出配置實(shí)例
方法
--是
閱讀排行榜
1.?[原創(chuàng)]slf4j+logback 多個日志輸出配置實(shí)例(10726)
2.?[原創(chuàng)]Spring+Quartz配置java定時任務(wù)實(shí)例(931)
3.?[原創(chuàng)]使用apache commons包讀取配置文件(736)
4.?[原創(chuàng)]凍結(jié)excel的行與列(190)
評論排行榜
1.?[原創(chuàng)]slf4j+logback 多個日志輸出配置實(shí)例(1)
2.?[原創(chuàng)]凍結(jié)excel的行與列(0)
3.?[原創(chuàng)]Spring+Quartz配置java定時任務(wù)實(shí)例(0)
4.?[原創(chuàng)]使用apache commons包讀取配置文件(0)
[原創(chuàng)]Spring+Quartz配置java定時任務(wù)實(shí)例
Java默認(rèn)定時器Timer一般也能滿足定時的需求, 但是使用Spring+Quartz來配置定時任務(wù), 更加靈活強(qiáng)大.
例子如下:
一, Maven依賴包
1
<
dependency
>
2
<
groupId
>
org.quartz-scheduler
</
groupId
>
3
<
artifactId
>
quartz
</
artifactId
>
4
<
version
>
1.8.0
</
version
>
5
<
type
>
jar
</
type
>
6
</
dependency
>
7
<
dependency
>
8
<
groupId
>
org.springframework
</
groupId
>
9
<
artifactId
>
spring-aop
</
artifactId
>
10
<
version
>
${spring.version}
</
version
>
11
<
type
>
jar
</
type
>
12
<
scope
>
compile
</
scope
>
13
</
dependency
>
14
<
dependency
>
15
<
groupId
>
org.springframework
</
groupId
>
16
<
artifactId
>
spring-beans
</
artifactId
>
17
<
version
>
${spring.version}
</
version
>
18
<
type
>
jar
</
type
>
19
<
scope
>
compile
</
scope
>
20
</
dependency
>
21
<
dependency
>
22
<
groupId
>
org.springframework
</
groupId
>
23
<
artifactId
>
spring-context
</
artifactId
>
24
<
version
>
${spring.version}
</
version
>
25
<
type
>
jar
</
type
>
26
</
dependency
>
27
<
dependency
>
28
<
groupId
>
org.springframework
</
groupId
>
29
<
artifactId
>
spring-context-support
</
artifactId
>
30
<
version
>
${spring.version}
</
version
>
31
<
type
>
jar
</
type
>
32
</
dependency
>
33
<
dependency
>
34
<
groupId
>
org.springframework
</
groupId
>
35
<
artifactId
>
spring-core
</
artifactId
>
36
<
version
>
${spring.version}
</
version
>
37
<
type
>
jar
</
type
>
38
</
dependency
>
39
<
dependency
>
40
<
groupId
>
org.springframework
</
groupId
>
41
<
artifactId
>
spring-jdbc
</
artifactId
>
42
<
version
>
${spring.version}
</
version
>
43
<
type
>
jar
</
type
>
44
</
dependency
>
45
<
dependency
>
46
<
groupId
>
org.springframework
</
groupId
>
47
<
artifactId
>
spring-tx
</
artifactId
>
48
<
version
>
${spring.version}
</
version
>
49
<
type
>
jar
</
type
>
50
</
dependency
>
51
<
dependency
>
52
<
groupId
>
org.springframework
</
groupId
>
53
<
artifactId
>
spring-tx
</
artifactId
>
54
<
version
>
${spring.version}
</
version
>
55
<
type
>
jar
</
type
>
56
</
dependency
>
二, 配置文件 SpringTest.xml
1
<
beans
xmlns
="http://www.springframework.org/schema/beans"
2
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
3
xsi:schemaLocation
="http://www.springframework.org/schema/beans
4
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>
5
6
<
bean
name
="ftpManager"
class
="org.springframework.scheduling.quartz.JobDetailBean"
>
7
<
property
name
="jobClass"
value
="com.test.FTPManager"
/>
8
</
bean
>
9
10
<!--
Cron Trigger, run every 1 minute
-->
11
<
bean
id
="cronTriggerFtpManager"
class
="org.springframework.scheduling.quartz.CronTriggerBean"
>
12
<
property
name
="jobDetail"
ref
="ftpManager"
/>
13
<
property
name
="cronExpression"
value
="0 0/1 * * * ?"
/>
14
</
bean
>
15
16
<
bean
class
="org.springframework.scheduling.quartz.SchedulerFactoryBean"
>
17
<
property
name
="jobDetails"
>
18
<
list
>
19
<
ref
bean
="ftpManager"
/>
20
</
list
>
21
</
property
>
22
23
<
property
name
="triggers"
>
24
<
list
>
25
<
ref
bean
="cronTriggerFtpManager"
/>
26
</
list
>
27
</
property
>
28
</
bean
>
29
30
</
beans
>
三, Java類
1
public
class
FTPManager
extends
QuartzJobBean
2
{
3
}
4
posted on 2013-05-23 16:32
大雨大雨
閱讀(931)
評論(0)
編輯
收藏
所屬分類:
JAVA
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
[原創(chuàng)]Spring+Quartz配置java定時任務(wù)實(shí)例
[原創(chuàng)]使用apache commons包讀取配置文件
[原創(chuàng)]slf4j+logback 多個日志輸出配置實(shí)例
Powered by:
BlogJava
Copyright ©2025 大雨大雨
主站蜘蛛池模板:
亚洲国产精品一区二区久久hs
|
免费黄色网址网站
|
啊灬啊灬别停啊灬用力啊免费看
|
亚洲AV无码专区在线亚
|
2021精品国产品免费观看
|
亚洲精品日韩专区silk
|
猫咪免费人成网站在线观看
|
亚洲日本国产精华液
|
aa级一级天堂片免费观看
|
国产成+人+综合+亚洲专
|
免费黄色毛片视频
|
国产亚洲午夜精品
|
亚洲性久久久影院
|
三年片在线观看免费
|
亚洲国产精久久久久久久
|
99久久久精品免费观看国产
|
一本色道久久88亚洲精品综合
|
国产亚洲中文日本不卡二区
|
99视频在线精品免费观看6
|
亚洲av无码专区在线电影
|
亚洲精品视频久久久
|
免费成人在线视频观看
|
亚洲天堂福利视频
|
国产成人免费福利网站
|
你懂得的在线观看免费视频
|
亚洲最新永久在线观看
|
成年人在线免费观看
|
污污污视频在线免费观看
|
亚洲爱情岛论坛永久
|
免费A级毛片无码免费视
|
无码人妻一区二区三区免费视频
|
亚洲熟妇无码乱子AV电影
|
69xx免费观看视频
|
男人j进女人p免费视频
|
日韩精品亚洲人成在线观看
|
a级毛片免费高清视频
|
亚洲国产综合91精品麻豆
|
免费被黄网站在观看
|
a级毛片在线免费观看
|
亚洲一区二区三区免费在线观看
|
亚洲成av人在片观看
|