spring job的配置

spring job的配置

 

applicationContext-job.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- 定时更新SaleFreight活动状态 -->
 <bean id="salefreighttimer" class="com.saiwei.util.SaleFreightTimer">
  <property name="sessionFactory"  ref="sessionFactory"/>
 </bean>
 
 <bean id="salefreighttask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">           
    <property name="targetObject">    
                <ref bean="salefreighttimer"/>      
    </property>           
       <property name="targetMethod">   
                    <value>SaleFreight</value> 
       </property> 
   </bean>
  
   <bean id="updateTime" class="org.springframework.scheduling.quartz.CronTriggerBean">     
           <property name="jobDetail">              
             <ref bean="salefreighttask"/>         
           </property>         
            <property name="cronExpression">  

    <!-- 每天凌晨00:00:01执行 -->
               <value>1 0 0 * * ?</value>
             </property>     
   </bean>
  
   <bean lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                <property name="triggers">       
              <list>                 
                    <ref bean="updateTime"/>
              </list>           
                </property>        
   </bean>
</beans>

 

 

 

转自http://blog.sina.com.cn/s/blog_6f2b4e370100lzb8.html

posted @ 2013-04-16 09:06  梦神十夜  阅读(241)  评论(0编辑  收藏  举报