applicationContext-quartz.xml 3.17 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:task="http://www.springframework.org/schema/task"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-4.2.xsd
                        http://www.springframework.org/schema/task
                        http://www.springframework.org/schema/task/spring-task.xsd">
	<!-- see java based configuration file -->

    <task:annotation-driven/>
    <context:annotation-config/>  
    <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>  

	<!-- 配置调度程序quartz 
	<bean id="indexRebuildJob" class="IndexRebuildJob" />
	
	<bean id="indexRebuildJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="indexRebuildJob" />
		</property>
		<property name="targetMethod">
			<value>execute</value>
		</property>
	</bean>
	<bean id="indexRebuildJobCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail" ref="indexRebuildJobDetail"></property>
		<property name="cronExpression" value="0 0 3 * * ?"></property>
	</bean>
-->
	<!-- ======================== 调度触发器 ======================== 
	<bean id="rebuildTblProductIndexJobDetail"
		  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="indexRebuildJob" />
		</property>
		<property name="targetMethod">
			<value>rebuildTblProductIndex</value>
		</property>
	</bean>
	<bean id="rebuildTblProductIndexCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail" ref="rebuildTblProductIndexJobDetail"></property>
		<property name="cronExpression" value="0 50 * * * ?"></property>
	</bean>
	
	<bean id="tplAdaptorJob" class="TplAdaptorJob" />
	<bean id="tplAdaptorJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="tplAdaptorJob" />
		</property>
		<property name="targetMethod">
			<value>doTplAdaptor</value>
		</property>
	</bean>
	<bean id="tplAdaptorJobCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail" ref="tplAdaptorJobDetail"></property>
		<property name="cronExpression" value="0 55 * * * ?"></property>
	</bean>
-->
	<!-- ======================== 调度工厂 ======================== 
	<bean id="SpringJobSchedulerFactoryBean"
		  class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers">
			<list>
				<ref bean="indexRebuildJobCronTrigger" />
				<ref bean="rebuildTblProductIndexCronTrigger" />
				<ref bean="tplAdaptorJobCronTrigger" />
			</list>
		</property>
	</bean>
-->
</beans>