<?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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 分布式事务配置 start --> <!-- 配置线程池--> <bean name="executor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="15"/> <property name="maxPoolSize" value="25"/> <property name="queueCapacity" value="100"/> </bean> <bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 配置调度任务--> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:job.properties"/> <property name="dataSource" ref="dataSource"/> <property name="transactionManager" ref="transactionManager"/> <!-- 任务唯一的名称,将会持久化到数据库--> <property name="schedulerName" value="baseScheduler"/> <!-- 每台集群机器部署应用的时候会更新触发器--> <property name="overwriteExistingJobs" value="true"/> <property name="applicationContextSchedulerContextKey" value="app_schedule_key"/> <property name="jobFactory"> <bean class="pwc.taxtech.atms.common.schedule.AutowiringSpringBeanJobFactory"/> </property> <property name="triggers"> <list> <ref bean="lgApiJobTrigger"/> </list> </property> <property name="jobDetails"> <list> <ref bean="lgGlBalanceJob"/> </list> </property> <property name="taskExecutor" ref="executor"/> </bean> <!-- 配置Job详情 --> <bean name="lgGlBalanceJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="pwc.taxtech.atms.common.schedule.LgGlBalanceJob"/> <property name="durability" value="true"/> <property name="requestsRecovery" value="false"/> <property name="description" value="科目余额数据同步"/> </bean> <!-- 定时任务 --> <bean id="lgApiJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="lgGlBalanceJob"/> <property name="cronExpression" value="0 0 1 3 * ?"/> </bean> <!-- 分布式事务配置 end --> </beans>