applicationContext-quartz.xml 3.7 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
 71
 72
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cache="http://www.springframework.org/schema/cache" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

<!-- ams消息生成 -->
<bean id="generateAmsWorkTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 要调用的bean -->
<property name="targetObject" ref="msgGenerateService"></property>
<!-- 要调用的Method -->
<property name="targetMethod" value="generaterAllAmsMsg"></property>
<!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
<property name="concurrent" value="false"></property>
</bean>

<!--&lt;!&ndash; 配置一个触发器 &ndash;&gt;-->
<bean id="genAmsWorkTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="generateAmsWorkTask"></property>
<property name="cronExpression" value="0 0 1 * * ?"></property>
</bean>


<!-- 模板消息 -->
<bean id="generateTmpWorkTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 要调用的bean -->
<property name="targetObject" ref="msgGenerateService"></property>
<!-- 要调用的Method -->
<property name="targetMethod" value="generaterAllTmpMsg"></property>
<!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
<property name="concurrent" value="false"></property>
</bean>

<!--&lt;!&ndash; 配置一个触发器 &ndash;&gt;-->
<bean id="genTmpWorkTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="generateTmpWorkTask"></property>
<property name="cronExpression" value="0 0 3 * * ?"></property>
</bean>


<!-- 孕妇课程 -->
<bean id="generateCourseWorkTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 要调用的bean -->
<property name="targetObject" ref="msgGenerateService"></property>
<!-- 要调用的Method -->
<property name="targetMethod" value="generaterAllCourseMsg"></property>
<!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
<property name="concurrent" value="false"></property>
</bean>

<!--一个小时生成一次-->
<bean id="genCourseWorkTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="generateCourseWorkTask"></property>
<property name="cronExpression" value="0 0 0/1 * * ?"></property>
</bean>

<!-- 总调度,用于启动定时器 -->
<bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers" >
<list>
<!--<ref bean="genAmsWorkTrigger"/>-->
<!--<ref bean="genTmpWorkTrigger"/>-->
<!--<ref bean="genCourseWorkTrigger"/>-->
</list>
</property>
</bean>
</beans>