Newer
Older
xxl-job-dm / xxl-job-admin / src / main / resources / applicationcontext-trigger-db.xml
xueli.xue on 1 Dec 2015 2 KB init
<?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:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/util 
           http://www.springframework.org/schema/util/spring-util.xsd">

	<!-- Job trigger -->
	<bean id="job02Trigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
		<property name="jobDetail" >
			<bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
				<property name="jobClass" value="com.xxl.service.job.JobDetailDemo"/>
				<property name="jobDataAsMap">
					<map>
						<!-- <entry key="xxService" value-ref="xxService" /> -->
					</map>
				</property>  
				<property name="durability" value="true" />
			</bean>
		</property>
		<property name="cronExpression" value="0/3 * * * * ? *" />
	</bean>

	<!-- Job信息会被上报并持久化到mysql中,多个集群节点中竞争Job锁,只会有一台执行 -->
	<bean id="quartzScheduler" lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="dataSource" ref="dataSource" />
        <property name="autoStartup" value="true" />
		<property name="applicationContextSchedulerContextKey"  value="applicationContextKey" /> 
        <property name="configLocation" value="classpath:quartz.properties"/>
		<property name="triggers">
			<list>
				<!-- <ref bean="job02Trigger" /> -->
			</list>
		</property>
	</bean>
	
	<!-- 调度器 -->
	<bean id="dynamicSchedulerUtil" class="com.xxl.quartz.DynamicSchedulerUtil">
        <property name="scheduler" ref="quartzScheduler"/>
    </bean>

</beans>