<?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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 配置01、JobHandler 扫描路径 --> <context:component-scan base-package="com.xxl.job.executor.service.jobhandler" /> <!-- 配置02、执行器 --> <bean id="xxlJobExecutor" class="com.xxl.job.core.executor.jetty.XxlJobExecutor" init-method="start" destroy-method="destroy" > <!-- 执行器端口号 --> <property name="port" value="9999" /> </bean> <!-- 配置03、GlueFactory (启用GLUE任务时才需要, 否则可删除) --> <bean id="glueFactory" class="com.xxl.job.core.glue.GlueFactory"> <!-- GLUE任务示例缓存失效时间, 单位/ms --> <property name="cacheTimeout" value="10000" /> <!-- GLUE 代码加载器,推荐将该服务配置成RPC服务 --> <property name="glueLoader" > <bean class="com.xxl.job.core.glue.loader.impl.DbGlueLoader" > <!-- XXL-JOB公共数据源 --> <property name="dataSource" ref="dataSource" /> </bean> </property> </bean> <!-- 配置04、XXL-JOB公共数据源 (启用GLUE任务, 且使用 "DbGlueLoader" 作为 "GLUE源码加载器" 时才需要, 否则可删除) --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${c3p0.driverClass}" /> <property name="jdbcUrl" value="${c3p0.url}" /> <property name="user" value="${c3p0.user}" /> <property name="password" value="${c3p0.password}" /> <property name="initialPoolSize" value="3" /> <property name="minPoolSize" value="2" /> <property name="maxPoolSize" value="10" /> <property name="maxIdleTime" value="60" /> <property name="acquireRetryDelay" value="1000" /> <property name="acquireRetryAttempts" value="10" /> <property name="preferredTestQuery" value="SELECT 1" /> </bean> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="fileEncoding" value="utf-8" /> <property name="location"> <value>classpath:jdbc.properties</value> </property> </bean> </beans>