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>