|
@@ -1,71 +1,90 @@
|
|
-<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
|
|
- xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
|
|
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
|
|
|
- http://www.springframework.org/schema/aop
|
|
|
|
- http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
|
|
|
- http://www.springframework.org/schema/tx
|
|
|
|
- http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
|
|
- <property name="fileEncoding" value="utf-8" />
|
|
|
|
- <property name="locations">
|
|
|
|
- <list>
|
|
|
|
- <value>classpath*:jdbc.properties</value>
|
|
|
|
- </list>
|
|
|
|
- </property>
|
|
|
|
- </bean>
|
|
|
|
-
|
|
|
|
- <!-- part 1 :for datasource -->
|
|
|
|
- <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="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
|
|
- <property name="dataSource" ref="dataSource" />
|
|
|
|
- <property name="mapperLocations" value="classpath:mybatis-mapper/*.xml"/>
|
|
|
|
- </bean>
|
|
|
|
-
|
|
|
|
- <!-- scope must be "prototype" when junit -->
|
|
|
|
- <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
|
|
|
|
- <constructor-arg index="0" ref="sqlSessionFactory" />
|
|
|
|
- </bean>
|
|
|
|
-
|
|
|
|
- <!-- part 2 :for tx -->
|
|
|
|
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
|
|
- <property name="dataSource" ref="dataSource" />
|
|
|
|
- </bean>
|
|
|
|
-
|
|
|
|
- <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
|
|
|
-
|
|
|
|
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
|
|
- <tx:attributes>
|
|
|
|
- <tx:method name="detail*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="visit*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="get*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="find*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="check*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="list*" propagation="SUPPORTS" />
|
|
|
|
- <tx:method name="*" propagation="REQUIRED" rollback-for="exception" />
|
|
|
|
- </tx:attributes>
|
|
|
|
- </tx:advice>
|
|
|
|
-
|
|
|
|
- <aop:config>
|
|
|
|
- <aop:pointcut id="txoperation" expression="execution(* com.xxl.job.admin.service.impl.*.*(..))" />
|
|
|
|
- <aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
|
|
|
|
- </aop:config>
|
|
|
|
-
|
|
|
|
|
|
+<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
|
|
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
|
|
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
|
|
|
+ http://www.springframework.org/schema/aop
|
|
|
|
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
|
|
|
|
+ http://www.springframework.org/schema/tx
|
|
|
|
+ http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
|
|
+ <property name="fileEncoding" value="utf-8" />
|
|
|
|
+ <property name="locations">
|
|
|
|
+ <list>
|
|
|
|
+ <value>classpath*:xxl-job-admin.properties</value>
|
|
|
|
+ </list>
|
|
|
|
+ </property>
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
|
|
+ <!-- part 1 :for datasource -->
|
|
|
|
+ <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
|
|
|
|
+ <property name="driverClass" value="${xxl.job.db.driverClass}" />
|
|
|
|
+ <property name="jdbcUrl" value="${xxl.job.db.url}" />
|
|
|
|
+ <property name="user" value="${xxl.job.db.user}" />
|
|
|
|
+ <property name="password" value="${xxl.job.db.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="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
|
|
+ <property name="dataSource" ref="dataSource" />
|
|
|
|
+ <property name="mapperLocations" value="classpath:mybatis-mapper/*.xml"/>
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
|
|
+ <!-- scope must be "prototype" when junit -->
|
|
|
|
+ <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
|
|
|
|
+ <constructor-arg index="0" ref="sqlSessionFactory" />
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
|
|
+ <!-- part 2 :for tx -->
|
|
|
|
+ <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
|
|
+ <property name="dataSource" ref="dataSource" />
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
|
|
+ <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
|
|
|
+
|
|
|
|
+ <tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
|
|
+ <tx:attributes>
|
|
|
|
+ <tx:method name="detail*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="visit*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="get*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="find*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="check*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="list*" propagation="SUPPORTS" />
|
|
|
|
+ <tx:method name="*" propagation="REQUIRED" rollback-for="exception" />
|
|
|
|
+ </tx:attributes>
|
|
|
|
+ </tx:advice>
|
|
|
|
+
|
|
|
|
+ <aop:config>
|
|
|
|
+ <aop:pointcut id="txoperation" expression="execution(* com.xxl.job.admin.service.impl.*.*(..))" />
|
|
|
|
+ <aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
|
|
|
|
+ </aop:config>
|
|
|
|
+
|
|
|
|
+ <!-- part 3 :for quartz -->
|
|
|
|
+ <bean id="quartzScheduler" lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
|
|
|
+ <property name="dataSource" ref="dataSource" />
|
|
|
|
+ <property name="autoStartup" value="true" /> <!--自动启动 -->
|
|
|
|
+ <property name="startupDelay" value="20" /> <!--延时启动 -->
|
|
|
|
+ <property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
|
|
|
|
+ <property name="configLocation" value="classpath:quartz.properties"/>
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
|
|
+ <!-- 协同-调度器 -->
|
|
|
|
+ <bean id="xxlJobDynamicScheduler" class="com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler" init-method="init" destroy-method="destroy" >
|
|
|
|
+ <!-- (轻易不要变更“调度器名称”, 任务创建时会绑定该“调度器名称”) -->
|
|
|
|
+ <property name="scheduler" ref="quartzScheduler"/>
|
|
|
|
+ <!-- 调度中心回调IP[选填],为空则自动获取 -->
|
|
|
|
+ <property name="callBackIp" value="${xxl.job.callBackIp}"/>
|
|
|
|
+ <!-- 调度中心回调端口号 -->
|
|
|
|
+ <property name="callBackPort" value="${xxl.job.callBackPort}"/>
|
|
|
|
+ </bean>
|
|
|
|
+
|
|
</beans>
|
|
</beans>
|