[color=brown][size=x-large]Spring的定时任务调度:[/[/size]color]
<beans>
<!-- 定时任务 -->
<bean id="springQuartzTask" class="定时任务的逻辑处理"></bean>
<bean id="springRecitePushTarget"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="springQuartzTask" />
</property>
<property name="targetMethod">
<value>定时处理的逻辑方法</value>
</property>
</bean>
<bean id="springRecitePushTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="springRecitePushTarget" />
</property>
<property name="cronExpression">
<value>0 56 12 * * ?</value> <!--每天的下午四点35分执行一次-->
<!-- <value>0 0 1 * * ?</value>--> <!--每天的一点钟执行一次-->
<!-- <value>0 */1 * * * ?</value>--> <!-- 每5分钟实行一次 -->
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
<property name="triggers">
<list>
<ref local="springRecitePushTrigger"/>
</list>
</property>
</bean>
</beans>
<beans>
<!-- 定时任务 -->
<bean id="springQuartzTask" class="定时任务的逻辑处理"></bean>
<bean id="springRecitePushTarget"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="springQuartzTask" />
</property>
<property name="targetMethod">
<value>定时处理的逻辑方法</value>
</property>
</bean>
<bean id="springRecitePushTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="springRecitePushTarget" />
</property>
<property name="cronExpression">
<value>0 56 12 * * ?</value> <!--每天的下午四点35分执行一次-->
<!-- <value>0 0 1 * * ?</value>--> <!--每天的一点钟执行一次-->
<!-- <value>0 */1 * * * ?</value>--> <!-- 每5分钟实行一次 -->
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
<property name="triggers">
<list>
<ref local="springRecitePushTrigger"/>
</list>
</property>
</bean>
</beans>