现在的位置: 首页 > 综合 > 正文

spring 定时器

2013年12月17日 ⁄ 综合 ⁄ 共 1049字 ⁄ 字号 评论关闭

 <bean id="mmsSetnBox" scope="prototype" class="xx.xx(类名)" autowire="byName"/>
     <bean id="mmsSentBoxmethodInvokingJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  <property name="targetObject">
   <ref bean="mmsSetnBox"/>
  </property>
  <property name="targetMethod">
   <value>mmsSentboxTimer(类中的方法)</value>
  </property>
  <property name="concurrent" value="false"/>
    </bean>

-----------------------------------------------------------

<bean id="mmsSentBoxcronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
     <property name="jobDetail">
      <ref bean="mmsSentBoxmethodInvokingJobDetail"/>
     </property>
     <property name="cronExpression">
      <value>10 1/1 * * * ?(运行时间每一分钟执行一次)</value>
     </property>
    </bean>

----------------------------------------------------------------

 <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
     <property name="triggers">
      <list>
    
    <ref local="mmsSentBoxcronTrigger"/>//调用
     
   </list>
     </property>
    </bean>

【上篇】
【下篇】

抱歉!评论已关闭.