Spring中scheduler+(定时器)的配置

本事例,定义了下定义了一个scheduler,该scheduler的作用是:每天上午12点执行一次com.tax.tm.TestScheduler中的deleletAllTempFile这个方法。

<!-- test springframework`s scheduler -->

 <bean id="testScheduler" class="com.tax.tm.TestScheduler"></bean>

 <bean id="jobDetail"
  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  <property name="targetObject" ref="testScheduler" />
  <property name="targetMethod" value="deleletAllTempFile" />
 </bean>

 <bean id="cronTrigger"
  class="org.springframework.scheduling.quartz.CronTriggerBean">
  <property name="jobDetail" ref="jobDetail" />
  <!-- run every noon at 12 AM -->
  <property name="cronExpression" value="01 01 12 * * ?" />
 </bean>


 <bean
  class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  <property name="triggers">
   <list>
    <ref bean="cronTrigger" />
   </list>
  </property>
 </bean> 

你可能感兴趣的:(spring,bean,list,Class,triggers)