[转] 定时调用相应的方法 - Spring调度
时间:2010-10-12 来源:JackieW
定时调度
Xml代码- <!-- 自动生成autoCreatesiteMap -->
- <bean name="autoCreatesiteMap" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
- <property name="targetObject" ref="siteMapAutoProduce"/>
- <property name="targetMethod">
- <value>doProdue</value>
- </property>
- <property name="concurrent">
- <value>false</value>
- </property>
- </bean>
- <!-- 自动生成autoCreatesiteMap的触发器 -->
- <bean id="siteMapTrigger"
- class="org.springframework.scheduling.quartz.CronTriggerBean">
- <property name="jobDetail">
- <ref bean="autoCreatesiteMap" />
- </property>
- <property name="cronExpression">
- <value>0 0/1 * * * ?</value>
- </property>
- </bean>
- <bean id="sfb" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
- <!-- 添加触发器 -->
- <property name="triggers">
- <list>
- <ref local="siteMapTrigger" />
- </list>
- </property>
- </bean>
<!-- 自动生成autoCreatesiteMap --> <bean name="autoCreatesiteMap" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="siteMapAutoProduce"/> <property name="targetMethod"> <value>doProdue</value> </property> <property name="concurrent"> <value>false</value> </property> </bean> <!-- 自动生成autoCreatesiteMap的触发器 --> <bean id="siteMapTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="autoCreatesiteMap" /> </property> <property name="cronExpression"> <value>0 0/1 * * * ?</value> </property> </bean> <bean id="sfb" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 添加触发器 --> <property name="triggers"> <list> <ref local="siteMapTrigger" /> </list> </property> </bean>
相关阅读 更多 +