<bean name="batchtaskJob" class="com.test.service.WebService2dbBatchService" />
<bean id="methodInvokingJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="batchtaskJob" />
</property>
<property name="targetMethod">
<value>save</value>
</property>
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="methodInvokingJobDetail" />
</property>
<!--每天的早上6:00触发-->
<property name="cronExpression">
<value>0 0 6 * * ?</value>
</property>
</bean>
<!-- 添加触发器 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref local="cronTrigger" />
</list>
</property>
</bean>
使用Spring配置Quartz定时调度
最新推荐文章于 2024-07-22 18:03:53 发布