Mybatisplus configuring multiple data sources (II)

goodlook0123 2022-02-13 08:12:05 阅读数:955

mybatisplus configuring multiple data sources

Today I'm going to share mybatisplus Configure multiple data sources ( By reading the database ). This configuration is suitable for scenarios where the number of data sources is uncertain , But when the data structure model is almost consistent . The scenario used in our project is , A project collection N individual erp database .

The version information used in the project is as follows :

springbooot:2.3.2.RELEASE

mybatisplus:3.4.3.3

Database master database uses mysql, Multi data source theory supports various databases ( You need to import the corresponding database jar).

So let's see mybatisplus Which databases are supported , By reading the source code DbType You can see that the following screenshot database is supported :

Introduction in case SqlServer and MySQL, Need to be in pom introduce jar

 <dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.0.jre8</version>
</dependency>
<!--druid introduce -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId
copyright:author[goodlook0123],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130812030594.html