applicationcontext-xxl-job.xml 2.9 KB
Newer Older
X
xueli.xue 已提交
1 2
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
X
xueli.xue 已提交
3 4 5
       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
X
xueli.xue 已提交
6 7
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
X
xueli.xue 已提交
8
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
X
xueli.xue 已提交
9

X
xueli.xue 已提交
10 11
    <!-- ********************************* 基础配置 ********************************* -->

X
xueli.xue 已提交
12 13
	<!-- 配置01、JobHandler 扫描路径 -->
	<context:component-scan base-package="com.xxl.job.executor.service.jobhandler" />
X
xueli.xue 已提交
14

X
xueli.xue 已提交
15
	<!-- 配置02、执行器 -->
X
xueli.xue 已提交
16
	<bean id="xxlJobExecutor" class="com.xxl.job.core.executor.jetty.XxlJobExecutor" init-method="start" destroy-method="destroy" >
X
xueli.xue 已提交
17
		<!-- 执行器端口号 -->
X
xueli.xue 已提交
18 19
		<property name="port" value="9999" />
	</bean>
20

X
xueli.xue 已提交
21 22 23
    <!-- ********************************* "GlueFactory" 配置, 仅在启动 "GLUE模式任务" 时才需要, 否则可删除 ********************************* -->

	<!-- 配置03、GlueFactory -->
X
xueli.xue 已提交
24
	<bean id="glueFactory" class="com.xxl.job.core.glue.GlueFactory">
X
xueli.xue 已提交
25
		<!-- GLUE任务示例缓存失效时间, 单位/ms -->
26
		<property name="cacheTimeout" value="10000" />
X
xueli.xue 已提交
27
		<!-- GLUE源码加载器,默认使用系统提供的 "DbGlueLoader", 推荐将其改为公共的RPC服务 -->
X
xueli.xue 已提交
28
		<property name="glueLoader" >
X
xueli.xue 已提交
29
            <!-- DbGlueLoader, 依赖 "XXL-JOB公共数据源" -->
X
xueli.xue 已提交
30
			<bean class="com.xxl.job.core.glue.loader.impl.DbGlueLoader" >
X
xueli.xue 已提交
31
				<!-- XXL-JOB公共数据源 -->
X
xueli.xue 已提交
32 33 34 35 36
				<property name="dataSource" ref="dataSource" />
			</bean>
		</property>
	</bean>

X
xueli.xue 已提交
37 38 39
    <!-- ********************************* "XXL-JOB公共数据源" 配置, 仅在启动 "GLUE模式任务" 的 "DbGlueLoader" 时才需要, 否则可删除 ********************************* -->

	<!-- 配置04、XXL-JOB公共数据源 -->
X
xueli.xue 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
	<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>
X
xueli.xue 已提交
58
	</bean>
X
xueli.xue 已提交
59

X
xueli.xue 已提交
60
</beans>