applicationContext_timer.xml 1.8 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:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
	
	<!-- websocket计划提醒-->
	<bean id="planjob" class="com.espeed.time.MarketingPlanSocketTimer" >		
		<property name="marketingplandao" ref="marketingplandao"></property>
		<property name="marketingweekdao" ref="marketingweekdao"></property>
	</bean>
	<bean id="planmethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject" ref="planjob" />
		<property name="targetMethod" value="planwebsocket" />
	</bean>
	<bean id="dotime" class="org.springframework.scheduling.quartz.CronTriggerBean">
		<property name="jobDetail">
			<ref bean="planmethod" />
		</property>
		<property name="cronExpression">
			<value>0/10 * * * * ?</value>
		</property>
	</bean>
	
	<!--  管理类 如果将lazy-init='false'那么容器启动就会执行调度程序     -->
	<bean id="startQuartz" lazy-init="false" autowire="no"
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers" >
			<list>
				<ref bean="dotime"/>
			</list>
		</property>
	</bean>

	<!--  注入scheduler   -->
	<bean id="updatetime" class="com.espeed.time.InitTimerTask">
		<property name="scheduler" ref="startQuartz" />
	</bean>
</beans>