[转] 定时调用相应的方法 - Spring调度

定时调度

Xml代码
  1. <!-- 自动生成autoCreatesiteMap -->  
  2.     <bean name="autoCreatesiteMap" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">  
  3.         <property name="targetObject" ref="siteMapAutoProduce"/>  
  4.         <property name="targetMethod">  
  5.             <value>doProdue</value>  
  6.         </property>  
  7.         <property name="concurrent">  
  8.             <value>false</value>  
  9.         </property>  
  10.     </bean>  
  11.     <!-- 自动生成autoCreatesiteMap的触发器 -->  
  12.     <bean id="siteMapTrigger"  
  13.         class="org.springframework.scheduling.quartz.CronTriggerBean">  
  14.         <property name="jobDetail">  
  15.             <ref bean="autoCreatesiteMap" />  
  16.         </property>  
  17.         <property name="cronExpression">  
  18.             <value>0 0/1 * * * ?</value>  
  19.         </property>  
  20.     </bean>  
  21.   
  22.   
  23. <bean id="sfb" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">  
  24.         <!-- 添加触发器 -->  
  25.         <property name="triggers">  
  26.             <list>  
  27.                 <ref local="siteMapTrigger" />  
  28.             </list>  
  29.         </property>  
  30.     </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>
 

 

posted on 2010-10-12 14:05  小星星☆★  阅读(306)  评论(0编辑  收藏  举报

导航