1. application.xml文件种配置
    –java
    在这里插入代码片
<?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:rdb="http://www.dangdang.com/schema/ddframe/rdb"xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.1.xsdhttp://www.dangdang.com/schema/ddframe/rdbhttp://www.dangdang.com/schema/ddframe/rdb/rdb.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"><context:property-placeholder location="classpath*:*.properties" ignore-unresolvable="true"/><context:annotation-config /><context:component-scan base-package="com.weijuju.iag.common"/><import resource="classpath*:iag-defaultRedis1.xml"/><import resource="classpath*:huaer-cmbRedis.xml"/><import resource="classpath*:core-dubbo.xml"/><import resource="classpath*:applicationContext-mq-producer.xml"/><!-- 数据库配置 --><context:annotation-config /><tx:annotation-driven transaction-manager="iagTransactionManager" /><bean id="iagDataSource" class="org.apache.commons.dbcp2.BasicDataSource"destroy-method="close" primary="true"><property name="driverClassName" value="${iag.db.driver}" /><property name="url" value="${iag.db.url}" /><property name="username" value="${iag.db.user}" /><property name="password" value="${iag.db.password}" /><property name="defaultAutoCommit" value="${iag.db.defaultAutoCommit}" /><property name="maxTotal" value="${iag.db.maxTotal}" /><property name="maxIdle" value="${iag.db.maxIdle}" /><!-- 默认10秒 --><property name="maxWaitMillis" value="${iag.db.maxWaitMillis:10000}" /><!-- 默认是8小时 --><property name="maxConnLifetimeMillis" value="${iag.db.maxConnLifetimeMillis:28800000}" /></bean><!-- 定义事务管理器(声明式的事务) --><context:annotation-config /><bean id="iagTransactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager" primary="true"><property name="dataSource" ref="iagDataSource" /></bean><bean id="iagSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="iagDataSource" /><property name="configLocation" value="classpath:iagMapperConfig.xml" /><property name="mapperLocations"><list><value>classpath*:sqlmap/**/*.xml</value></list></property></bean><bean id="iagMapperScannerConfig" class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="sqlSessionFactoryBeanName" value="iagSqlSessionFactory" /><property name="basePackage" value="com.weijuju.iag.mapper" /></bean><bean id="aliDataSource" class="org.apache.commons.dbcp2.BasicDataSource"destroy-method="close" primary="true"><property name="driverClassName" value="${aliyun.db.driver}" /><property name="url" value="${aliyun.db.url}" /><property name="username" value="${aliyun.db.user}" /><property name="password" value="${aliyun.db.password}" /><property name="defaultAutoCommit" value="${aliyun.db.defaultAutoCommit}" /><property name="maxTotal" value="${aliyun.db.maxTotal}" /><property name="maxIdle" value="${aliyun.db.maxIdle}" /><!-- 默认10秒 --><property name="maxWaitMillis" value="${iag.db.maxWaitMillis:10000}" /><!-- 默认是8小时 --><property name="maxConnLifetimeMillis" value="${iag.db.maxConnLifetimeMillis:28800000}" /></bean><!-- 定义事务管理器(声明式的事务) --><context:annotation-config /><bean id="aliTransactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager" primary="true"><property name="dataSource" ref="aliDataSource" /></bean><bean id="aliSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="aliDataSource" /><property name="configLocation" value="classpath:iagMapperConfig.xml" /><property name="mapperLocations"><list><value>classpath*:alisqlmap/**/*.xml</value></list></property></bean><bean id="aliMapperScannerConfig" class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="sqlSessionFactoryBeanName" value="aliSqlSessionFactory" /><property name="basePackage" value="aliyun.mapper" /></bean>
</beans>


填写数据库连接信息的对应的包路径


设置mapper.xml文件所在路径


设置mapper.java文件所在包路径

xml文件配置多数据源相关推荐

  1. SpringSecurity使用 配置文件 和wen.xml 文件配置

    目录 1.web.xml 文件配置 2.spring-security  普通 为使用自己创建的认证类 1.web.xml 文件配置 !-- 配置SpringSecurity的拦截器 -->&l ...

  2. eclipse mysql Xml配置_mysql8.0在eclipse中通过xml文件配置数据库连接池

    mysql8.0在eclipse中通过xml文件配置数据库连接池 1.关于Mysql8.0 2.数据库连接池(DBCP) 3.准备工作 4.配置context.xml 5.配置web.xml 6.调用 ...

  3. java spring bean配置文件_Spring基于xml文件配置Bean过程详解

    这篇文章主要介绍了spring基于xml文件配置Bean过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 通过全类名来配置: class:be ...

  4. Logback.xml 文件    配置

    2019独角兽企业重金招聘Python工程师标准>>> Logback.xml 文件    配置 <?xml version="1.0" encoding= ...

  5. 从前后端分离到前后端整合的“退步”(二)pom.xml文件配置

    系列文章目录 从前后端分离到前后端整合的"退步"(一)项目结构 从前后端分离到前后端整合的"退步"(二)pom.xml文件配置 Spring Boot + Vu ...

  6. Java 中JAF、CORBA、JTA、JAXB、JAX-WS使用Maven的pom.xml文件配置

    本文主要介绍Java EE中已经弃用的模块,需要单独引用JAF(java.activation).CORBA(java.corba).JTA(java.transaction).JAXB(java.x ...

  7. AndroidManifest.xml文件配置教程及相关指令详解

    AndroidManifest.xml 是每个android程序中必须的文件,它位于整个项目的根目录.我们每天都在使用这个文件,往里面配置程序运行所必要的组件,权限,以及一些相关信息.但是对于这个文件 ...

  8. spring,springmvc,mybatis基本整合(一)--xml文件配置方式(1)

    **这个整合.仅仅是最主要的整合,而且是xml配置文件的方式之中的一个,即当中的mybatis是採用非mapper接口的方式.(第二遍採用mapper接口方式.第三遍採用注解的方式:第四篇採用注解基于 ...

  9. Mybatis-mybatis使用xml文件配置

    一,概述: Mybatis官网 Mybatis介绍: Mybatis是一款优秀的持久层框架,它支持定制化SQL,存储过程以及高级映射.mybaits 避免了几乎所有的JDBC代码和手动设置参数以及获取 ...

最新文章

  1. linux FTP配置详解
  2. java远程操作ftp服务器上传下载
  3. C#并行编程中的Parallel.Invoke
  4. 网络流Dinic算法模板 POJ1273
  5. 华为编程规范_华为 Java 编程规范出炉,究竟和官方文档有何不同?
  6. angular4获得焦点事件_Angular 4 文本框自动获取焦点二
  7. c语言规范标准中英文,C语言中英文翻译资料.doc
  8. pcl里面的RoPs特征(Rotational Projection Statistics)
  9. python爬虫网站简单_Python爬虫之简单爬虫框架实现
  10. 如何用vrml技术实现虚拟计算机组装实验,基于VRML的计算机组装虚拟实验的研究与实现_吴兰.pdf...
  11. Codeforces Round #419 Div. 1
  12. 【电力负荷预测】基于matlab模拟退火算法结合狮群算法优化Elman神经网络电力负荷预测【含Matlab源码 1454期】
  13. 分区混乱,C盘不是系统盘怎么办?
  14. D1: elevater design
  15. 1597: [Usaco2008 Mar]土地购买
  16. HCNE实验指导文档(全)
  17. 【读书笔记】《谈谈方法》(笛卡尔)
  18. 计算机概论在线阅读,计算机科学概论(Python版)
  19. 交通安全精华主题汇总(至2023年01月29日)
  20. 实践篇·让你的图片特别起来—自定义像素化

热门文章

  1. 【DBN分类】基于matlab深度置信网络DBN变压器故障诊断【含Matlab源码 2284期】
  2. 百年孤独--给孤独且还在奋斗的你
  3. 网页图片批量获取 ※(依据国防科大招生网新版更新)
  4. mysql 连接局域网_如何在局域网连接mysql数据库?
  5. 修ITI.Transcendata.CADFIX.v11.SP1-ISO 1DVD
  6. TFS 本地文件夹映射
  7. 干货分享:超级浏览器使用感受
  8. Android 自定义Log 多模式
  9. 基于DEAP的脑电情绪识别论文源码改进版本(附论文代码,lstm和rnn)
  10. 合泰32-Onenet-WiFi模块-合泰单片机通过MQTT协议数据上云(一)