applicationContext_timer.xml
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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">
<!-- 营销发送定时器开始 -->
<bean id="quartjob" class="com.espeed.yxy.timer.SendMailTimer" >
<property name="yxysendmailservice" ref="yxysendmailservice"/>
</bean>
<bean id="objAndmethod"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="quartjob" />
<property name="targetMethod" value="timerMethod" />
</bean>
<bean id="dotime" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="objAndmethod" />
</property>
<property name="cronExpression">
<!--
<value>0/45 * * * * ?</value>
-->
<value>0 0/1 * * * ?</value>
</property>
</bean>
<!-- 营销发送定时器结束 -->
<!-- 营销计划定时器开始 -->
<bean id="markplanjob" class="com.espeed.yxy.timer.MarketingPlanTime" >
<property name="marketingplanservice" ref="marketingplanservice"/>
<property name="yxysendmailservice" ref="yxysendmailservice"/>
</bean>
<bean id="planobjmethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="markplanjob" />
<property name="targetMethod" value="marketingmethod" />
</bean>
<bean id="markplan" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="planobjmethod" />
</property>
<property name="cronExpression">
<value>0/50 * * * * ?</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"/>
<ref bean="markplan"/>
</list>
</property>
</bean>
<!-- 注入scheduler -->
<bean id="updatetime" class="com.espeed.yxy.timer.InitializingCronTrigger">
<property name="scheduler" ref="startQuartz" />
</bean>
</beans>