Spring集成Quartz定时器

时间:2023-12-29 21:15:38
<!-- Spring集成Quartz开始 -->

    <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="doTime"/>
</list>
</property>
</bean> <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="jobtask"/>
</property>
<property name="cronExpression">
<value>0 22 17 * * ?</value>
</property>
</bean>
<bean id="jobtask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="quartzJob"/>
</property>
<property name="targetMethod">
<value>TimerSync</value><!--调用方法-->
</property>
</bean>
<bean id="quartzJob" class="com.TaskAction"></bean><!--调用action--> <!-- Spring集成Quartz结束 -->