Spring定时器

whbing 2015-07-14

<!--定时器-->

<beanid="myTimer"class="service.Log_Service"></bean>

<!--定时器配置-->

<beanid="timeDitail"

class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

<propertyname="targetObject"ref="myTimer"></property><!--指定任务类-->

<propertyname="targetMethod"value="Timer"></property><!--指定任务方法-->

</bean>

<!--定义时间间隔触发器-->

<beanid="timeTigger"class="org.springframework.scheduling.quartz.CronTriggerBean">

<propertyname="jobDetail"ref="timeDitail"></property>

<propertyname="cronExpression">

<value>0/60****?</value>

</property>

</bean>

<!--启动定时器-->

<beanid="startJob"class="org.springframework.scheduling.quartz.SchedulerFactoryBean">

<propertyname="triggers">

<list>

<refbean="timeTigger"/>

</list>

</property>

</bean>

相关推荐