123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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 xxl-job scheduler ********************************* -->
- <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="overwriteExistingJobs" value="true" /> <!--覆盖DB中JOB:true、以数据库中已经存在的为准:false -->
- <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>
|