<?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"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-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/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<bean id="dataSource1" class="org.apache.ibatis.datasource.pooled.PooledDataSource">
<property name="driver" value="${jdbc.driverClassName}"></property>
<property name="url" value="${jdbc.url1}"/>
<property name="username" value="${jdbc.username1}"/>
<property name="password" value="${jdbc.password1}"/>
<property name="poolMaximumIdleConnections" value="50"/>
<property name="poolMaximumActiveConnections" value="50"/>
<property name="poolPingConnectionsNotUsedFor" value="30"></property>
<property name="defaultTransactionIsolationLevel" value="2"></property>
<property name="poolPingQuery" value="select 1"></property>
<property name="poolPingEnabled" value="true"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean>
<bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource1" />
</bean>
<tx:advice id="txAdvice1" transaction-manager="transactionManager1">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allServiceMethod1" expression="execution(* com.gm.service1..*(..))" />
<!-- 指定在txAdvice切入点应用txAdvice事务切面 -->
<aop:advisor advice-ref="txAdvice1" pointcut-ref="allServiceMethod1" order="1"/>
</aop:config>
<bean id="sqlSessionFactory1" class="org.mybatis.spring.SqlSessionFactoryBean" >
<property name="dataSource" ref="dataSource1" />
<property name="mapperLocations">
<list>
<value>classpath:com/db1/persistence/*.xml</value>
</list>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gm.dao1" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory1"></property>
</bean>
</beans>
相关推荐
Springboot mybatis 多数据源配置 项目实例·················
STS下spring boot、mybatis多数据源配置源码工程
Mybatis 多数据源配置说明: 同一个项目有时会涉及到多个数据库,也就是多数据源。多数据源又可以分为两种情况: 1)两个或多个数据库没有相关性,各自独立,其实这种可以作为两个项目来开发。比如在游戏开发中一个...
SSM(Spring+SpringMVC+MyBatis)多数据源配置框架,精简版
Spring下mybatis多数据源配置
springboot+mybatis多数据源配置整合。一个最简单的测试用例。实现了数据库数据处理及springboot多数据源问题。亲测
什么时候才用的到配置多数据源??当我们用不同数据库存放不同数据的时候。这个时候我们整个工程并不是只用一个数据库,所以,要配置多个,在具体的场景应用具体的数据源。
Spring下mybatis多数据源配置[参照].pdf
NULL 博文链接:https://bijian1013.iteye.com/blog/2435610
相信很多朋友在开发的时候,可能会碰到需要一个项目,配置多个数据源的需求,可能是同一种数据库,也可能是不同种类的数据库,这种情况,我们就需要配置多数据源对程序的支持了。 本项目就是一个多数据源的配置,...
SpringBootDemo_mutilDatasource是springboot基于mybatis多数据源实现的Demo
SpringBoot+gradle+mybatis多数据源动态配置 AOP的方式实现数据源动态切换。
springboot+mybatis多数据源+动态数据源配置(连接池),mysql数据库,代码实现了简单的读写分离,但是不建议这种操作,建议使用数据库中间件进行读写分离,例如使用mycat进行读写分离主从热备,使用该代码对于多个...
由springMVC+mybatis整合的多数据源配置,以及通过httpclient访问远程接口进行上传文件,具体的远程接口需要根据自己的需要去修改
springboot实现对mysql数据库多数据源,通过配置文件设置主数据源和其他数据源访问不同的数据库
springboot+mybatis双数据源配置及事务处理
从网上找的,可用,自己记录一下,如有侵权请联系删除。感谢原作者:纯洁的微笑。原博客:http://www.ityouknow.com/
https://docs.taosdata.com/connector/java/#hikaricp 参考官方文档即可。
NULL 博文链接:https://zhuchengzzcc.iteye.com/blog/1827633