railway-quartz.xml
1.53 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
<?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/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="checkIsLaidOffTask" class="com.xiniunet.quartz.CheckIsLaidOffQuartz"/>
<!-- 定义任务类和要执行的方法 -->
<bean id="checkIsLaidOff" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!--false:上个任务执行完毕后, 再开启新的人去-->
<property name="concurrent" value="false"/>
<!--执行对象-->
<property name="targetObject" ref="checkIsLaidOffTask"/>
<!--执行方法-->
<property name="targetMethod" value="execute"/>
</bean>
<bean id="checkIsLaidOffTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="checkIsLaidOff"/>
</property>
<!-- 关键在配置此表达式 每1分钟执行 -->
<property name="cronExpression">
<value>0 0/1 * * * ?</value>
</property>
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="checkIsLaidOffTrigger"></ref>
<!--<ref bean="tmallTestTrigger"></ref>-->
</list>
</property>
</bean>
</beans>