lecuntao-quartz.xml
1.54 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
<?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="reportSyncTask" class="com.lecuntao.ordering.customization.quartz.ReportSyncTask"/>
<bean id="reportSyncDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!--false:上个任务执行完毕后, 再开启新的人去-->
<property name="concurrent" value="false"/>
<!--执行对象-->
<property name="targetObject" ref="reportSyncTask"/>
<!--执行方法-->
<property name="targetMethod" value="execute"/>
</bean>
<bean id="reportSyncTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="reportSyncDetail"/>
</property>
<!-- 关键在配置此表达式 -->
<property name="cronExpression">
<!--<value>*/10 * * * * ?</value>-->
<!--<value>0 0/30 * * * ? </value>-->
<value>0 30 * * * ? </value>
<!-- 每分钟-->
</property>
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="reportSyncTrigger"></ref>
</list>
</property>
</bean>
</beans>