<!-- [if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!-- [if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><!-- [if !mso]>
<span class="mceItemObject"
classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
</span>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<!-- [if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->
<!--1.
简单定时
-->
<
bean id
=
"
myTask
"
class
=
"
usish.po.pub.MyTask
"
>
<!--
自己定义的任务
extends TimerTask -->
<
property name
=
"
generatPo
"
>
<
ref local
=
"
generatPO
"
/>
</
property
>
<
property name
=
"
importData
"
>
<
ref local
=
"
importData
"
/>
</
property
>
</
bean
>
<
bean id
=
"
timer
"
class
=
"
org.springframework.scheduling.timer.TimerFactoryBean
"
>
<
property name
=
"
scheduledTimerTasks
"
>
<
list
>
<
ref local
=
"
scheduledTimerTask_1
"
/> <!--
定时器的任务链
-->
</
list
>
</
property
>
</
bean
>
<
bean id
=
"
scheduledTimerTask_1
"
class
=
"
org.springframework.scheduling.timer.ScheduledTimerTask
"
> <!--
任务链启动任务
-->
<
property name
=
"
timerTask
"
>
<
ref local
=
"
myTask
"
/>
</
property
>
<
property name
=
"
delay
"
>
<
value
>
1000
</
value
>
</
property
>
<
property name
=
"
period
"
>
<
value
>
50000
</
value
>
</
property
>
</
bean
>
<!--2.
使用
Quartz
定时
-->
<!-- scheduler -->
<bean id="cacheClearStar"
class="com.ztgame.memcached.CacheClearStar" />
<bean id="cacheClearStarJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property
name="targetObject">
<ref local="cacheClearStar" />
</property>
<property
name="targetMethod">
<value>clear</value>
</property>
</bean>
<bean id="cacheClearStarTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref
local="cacheClearStarJob" />
</property>
<property
name="cronExpression">
<value>0 0 0 * * ?</value>
</property>
</bean>
<bean id="scheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="false">
<property
name="triggers">
<ref local="cacheClearStarTrigger" />
</property>
</bean>
<!-- scheduler end -->
一个
cron
表达式有至少
6
个(也可能
7
个)有空格分隔的时间元素。
按顺序依次为
1.
秒(
0~59
)
2.
分钟(
0~59
)
3.
小时(
0~23
)
4.
天(月)(
0~31
,但是你需要考虑你月的天数)
5.
月(
0~11
)
6.
天(星期)(
1~7 1=SUN
或
SUN
,
MON
,
TUE
,
WED
,
THU
,
FRI
,
SAT
)
7.
年份(
1970
-
2099
)
其中每个元素可以是一个值
(
如
6),
一个连续区间
(9-12),
一个间隔时间
(8-18/4)(/
表示每隔
4
小时
),
一个列表
(1,3,5),
通配符。
由于
"
月份中的日期
"
和
"
星期中的日期
"
这两个元素互斥的
,
必须要对其中一个设置
?.
0 0
10,14,16 * * ?
每天上午
10
点,下午
2
点,
4
点
0 0/30 9-17 * * ???
朝九晚五工作时间内每半小时
0 0 12 ? * WED
表示每个星期三中午
12
点
有些子表达式能包含一些范围或列表
例如:子表达式(天(星期))可以为
“MON-FRI”
,
“MON
,
WED
,
FRI”
,
“MON-WED,SAT”
“*”
字符代表所有可能的值
因此,
“*”
在子表达式(月)里表示每个月的含义,
“*”
在子表达式(天(星期))表示星期的每一天
“/”
字符用来指定数值的增量
例如:在子表达式(分钟)里的
“0/15”
表示从第
0
分钟开始,每
15
分钟
;
在子表达式(分钟)里的
“3/20”
表示从第
3
分钟开始,每
20
分钟(它和
“3
,
23
,
43”
)的含义一样
“
?
”
分享到:
相关推荐
Spring定时任务的几种实现,欢迎交流!
spring定时.txtspring定时.txtspring定时.txt
spring定时任务SimpleTrigger 和CronTrigger 配置
Spring定时调度简单实现源码.rar
spring spring spring spring定时任务所需jar 齐全
一个tomcat下部署了两个应用,一个是普通web应用syncc,另一个应用syncc_wx属于微信公众号后台程序涉及消息定时推送,tomcat未分离...”spring定时任务执行两次的异常排查处理.docx"针对上述描述问题进行分析和解决。
使用spring定时任务,使用spring+mybatis 向数据库中插入数据实例
Spring定时任务调用配置Spring定时任务调用配置Spring定时任务调用配置Spring定时任务调用配置Spring定时任务调用配置
spring定时任务 xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=...
Spring 定时任务 各参数详细说明,注解方式,简洁
spring 做定时器任务时所依赖的10个jar包,用于实现java定时任务。
Spring3.x企业应用开发实战 中 Spring 定时任务源码(spring 三种定时任务的实现方式),Spring quartz java 定时器 定时任务 源码
NULL 博文链接:https://bijian1013.iteye.com/blog/2380233
实现定时任务的执行操作!
自己写的Quartz+Sping定时触发器例子,包含全部jar包,可直接运行。注释完整,适合初学者学习。
java定时任务源码,spring定时任务源码,包含定时和spring必须包,直接导入可运行,无需连接数据库。
spring 定时任务 示例代码
Spring Quartz定时任务所需要的6个jar包:commons-collections.jar、commons-logging.jar、jta.jar、log4j-1.2.14.jar、quartz-all-1.6.0.jar、spring-2.0.6.jar