SpringBoot多数据源

<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.0.6</version>
</dependency>
<dependency>
	<groupId>com.baomidou</groupId>
	<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
	<version>3.0.0</version>
</dependency>



spring:
 datasource:
	dynamic:
	  # 设置默认数据源为db1
	  primary: db1
	  datasource:
		db1:
		  url: jdbc:sqlserver://127.0.0.1:3000;DatabaseName=db1
		  driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
		  username: sa
		  password: 123456
		db2:
		  url: jdbc:mysql://127.0.0.1:3306/db2
		  driver-class-name: com.mysql.jdbc.Driver
		  username: sa
		  password: 123456


@DS("db2")
public interface TestMapper extends BaseMapper<>{
}

上一篇:mysql笔记四 数据备份与还原


下一篇:【软件安装】重测序注释——snpEff 的使用