|
@@ -1,71 +1,90 @@
|
1
|
|
-<?xml version="1.0" encoding="UTF-8"?>
|
2
|
|
-<beans xmlns="http://www.springframework.org/schema/beans"
|
3
|
|
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
|
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
|
5
|
|
- xsi:schemaLocation="http://www.springframework.org/schema/beans
|
6
|
|
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
7
|
|
- http://www.springframework.org/schema/aop
|
8
|
|
- http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
9
|
|
- http://www.springframework.org/schema/tx
|
10
|
|
- http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
|
11
|
|
-
|
12
|
|
-
|
13
|
|
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
14
|
|
- <property name="fileEncoding" value="utf-8" />
|
15
|
|
- <property name="locations">
|
16
|
|
- <list>
|
17
|
|
- <value>classpath*:jdbc.properties</value>
|
18
|
|
- </list>
|
19
|
|
- </property>
|
20
|
|
- </bean>
|
21
|
|
-
|
22
|
|
- <!-- part 1 :for datasource -->
|
23
|
|
- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
|
24
|
|
- <property name="driverClass" value="${c3p0.driverClass}" />
|
25
|
|
- <property name="jdbcUrl" value="${c3p0.url}" />
|
26
|
|
- <property name="user" value="${c3p0.user}" />
|
27
|
|
- <property name="password" value="${c3p0.password}" />
|
28
|
|
- <property name="initialPoolSize" value="3" />
|
29
|
|
- <property name="minPoolSize" value="2" />
|
30
|
|
- <property name="maxPoolSize" value="10" />
|
31
|
|
- <property name="maxIdleTime" value="60" />
|
32
|
|
- <property name="acquireRetryDelay" value="1000" />
|
33
|
|
- <property name="acquireRetryAttempts" value="10" />
|
34
|
|
- <property name="preferredTestQuery" value="SELECT 1" />
|
35
|
|
- </bean>
|
36
|
|
-
|
37
|
|
- <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
38
|
|
- <property name="dataSource" ref="dataSource" />
|
39
|
|
- <property name="mapperLocations" value="classpath:mybatis-mapper/*.xml"/>
|
40
|
|
- </bean>
|
41
|
|
-
|
42
|
|
- <!-- scope must be "prototype" when junit -->
|
43
|
|
- <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
|
44
|
|
- <constructor-arg index="0" ref="sqlSessionFactory" />
|
45
|
|
- </bean>
|
46
|
|
-
|
47
|
|
- <!-- part 2 :for tx -->
|
48
|
|
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
49
|
|
- <property name="dataSource" ref="dataSource" />
|
50
|
|
- </bean>
|
51
|
|
-
|
52
|
|
- <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
53
|
|
-
|
54
|
|
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
|
55
|
|
- <tx:attributes>
|
56
|
|
- <tx:method name="detail*" propagation="SUPPORTS" />
|
57
|
|
- <tx:method name="visit*" propagation="SUPPORTS" />
|
58
|
|
- <tx:method name="get*" propagation="SUPPORTS" />
|
59
|
|
- <tx:method name="find*" propagation="SUPPORTS" />
|
60
|
|
- <tx:method name="check*" propagation="SUPPORTS" />
|
61
|
|
- <tx:method name="list*" propagation="SUPPORTS" />
|
62
|
|
- <tx:method name="*" propagation="REQUIRED" rollback-for="exception" />
|
63
|
|
- </tx:attributes>
|
64
|
|
- </tx:advice>
|
65
|
|
-
|
66
|
|
- <aop:config>
|
67
|
|
- <aop:pointcut id="txoperation" expression="execution(* com.xxl.job.admin.service.impl.*.*(..))" />
|
68
|
|
- <aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
|
69
|
|
- </aop:config>
|
70
|
|
-
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<beans xmlns="http://www.springframework.org/schema/beans"
|
|
3
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+ xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
5
|
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
6
|
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
|
7
|
+ http://www.springframework.org/schema/aop
|
|
8
|
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
|
9
|
+ http://www.springframework.org/schema/tx
|
|
10
|
+ http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+ <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
14
|
+ <property name="fileEncoding" value="utf-8" />
|
|
15
|
+ <property name="locations">
|
|
16
|
+ <list>
|
|
17
|
+ <value>classpath*:xxl-job-admin.properties</value>
|
|
18
|
+ </list>
|
|
19
|
+ </property>
|
|
20
|
+ </bean>
|
|
21
|
+
|
|
22
|
+ <!-- part 1 :for datasource -->
|
|
23
|
+ <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
|
|
24
|
+ <property name="driverClass" value="${xxl.job.db.driverClass}" />
|
|
25
|
+ <property name="jdbcUrl" value="${xxl.job.db.url}" />
|
|
26
|
+ <property name="user" value="${xxl.job.db.user}" />
|
|
27
|
+ <property name="password" value="${xxl.job.db.password}" />
|
|
28
|
+ <property name="initialPoolSize" value="3" />
|
|
29
|
+ <property name="minPoolSize" value="2" />
|
|
30
|
+ <property name="maxPoolSize" value="10" />
|
|
31
|
+ <property name="maxIdleTime" value="60" />
|
|
32
|
+ <property name="acquireRetryDelay" value="1000" />
|
|
33
|
+ <property name="acquireRetryAttempts" value="10" />
|
|
34
|
+ <property name="preferredTestQuery" value="SELECT 1" />
|
|
35
|
+ </bean>
|
|
36
|
+
|
|
37
|
+ <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
38
|
+ <property name="dataSource" ref="dataSource" />
|
|
39
|
+ <property name="mapperLocations" value="classpath:mybatis-mapper/*.xml"/>
|
|
40
|
+ </bean>
|
|
41
|
+
|
|
42
|
+ <!-- scope must be "prototype" when junit -->
|
|
43
|
+ <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
|
|
44
|
+ <constructor-arg index="0" ref="sqlSessionFactory" />
|
|
45
|
+ </bean>
|
|
46
|
+
|
|
47
|
+ <!-- part 2 :for tx -->
|
|
48
|
+ <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
49
|
+ <property name="dataSource" ref="dataSource" />
|
|
50
|
+ </bean>
|
|
51
|
+
|
|
52
|
+ <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
|
53
|
+
|
|
54
|
+ <tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
55
|
+ <tx:attributes>
|
|
56
|
+ <tx:method name="detail*" propagation="SUPPORTS" />
|
|
57
|
+ <tx:method name="visit*" propagation="SUPPORTS" />
|
|
58
|
+ <tx:method name="get*" propagation="SUPPORTS" />
|
|
59
|
+ <tx:method name="find*" propagation="SUPPORTS" />
|
|
60
|
+ <tx:method name="check*" propagation="SUPPORTS" />
|
|
61
|
+ <tx:method name="list*" propagation="SUPPORTS" />
|
|
62
|
+ <tx:method name="*" propagation="REQUIRED" rollback-for="exception" />
|
|
63
|
+ </tx:attributes>
|
|
64
|
+ </tx:advice>
|
|
65
|
+
|
|
66
|
+ <aop:config>
|
|
67
|
+ <aop:pointcut id="txoperation" expression="execution(* com.xxl.job.admin.service.impl.*.*(..))" />
|
|
68
|
+ <aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
|
|
69
|
+ </aop:config>
|
|
70
|
+
|
|
71
|
+ <!-- part 3 :for quartz -->
|
|
72
|
+ <bean id="quartzScheduler" lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
|
73
|
+ <property name="dataSource" ref="dataSource" />
|
|
74
|
+ <property name="autoStartup" value="true" /> <!--自动启动 -->
|
|
75
|
+ <property name="startupDelay" value="20" /> <!--延时启动 -->
|
|
76
|
+ <property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
|
|
77
|
+ <property name="configLocation" value="classpath:quartz.properties"/>
|
|
78
|
+ </bean>
|
|
79
|
+
|
|
80
|
+ <!-- 协同-调度器 -->
|
|
81
|
+ <bean id="xxlJobDynamicScheduler" class="com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler" init-method="init" destroy-method="destroy" >
|
|
82
|
+ <!-- (轻易不要变更“调度器名称”, 任务创建时会绑定该“调度器名称”) -->
|
|
83
|
+ <property name="scheduler" ref="quartzScheduler"/>
|
|
84
|
+ <!-- 调度中心回调IP[选填],为空则自动获取 -->
|
|
85
|
+ <property name="callBackIp" value="${xxl.job.callBackIp}"/>
|
|
86
|
+ <!-- 调度中心回调端口号 -->
|
|
87
|
+ <property name="callBackPort" value="${xxl.job.callBackPort}"/>
|
|
88
|
+ </bean>
|
|
89
|
+
|
71
|
90
|
</beans>
|