1、实现mybatis-plus的多个数据库的切换方式

     源码地址:https://github.com/baomidou/mybatisplus-spring-mvc

2、因为其文档都是相互依赖的,所以修改配置,就是在已有的配置中修改

     这里配置多数据源采用定义不同的profile方式修改启动时连接的数据库

     原版

       配置文件位置:https://github.com/baomidou/mybatisplus-spring-mvc/tree/master/src/main/resources/spring

 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:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
 5        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
 6 
 7     <!-- 引入属性文件 -->
 8     <context:property-placeholder location="classpath:config.properties"/>
 9 
10     <!-- Service包(自动注入) -->
11     <context:component-scan base-package="com.baomidou.springmvc.service"/>
12 
13     <import resource="classpath:spring/spring-mybatis.xml"/>
14 </beans>
View Code

相关文章:

  • 2021-08-30
  • 2022-12-23
  • 2021-04-22
  • 2021-11-02
  • 2021-06-26
  • 2021-05-25
  • 2021-08-15
  • 2021-10-22
猜你喜欢
  • 2021-10-22
  • 2021-07-01
  • 2022-12-23
  • 2021-07-12
  • 2021-10-30
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案