一、Sharding Sphere基本介绍
官网链接推荐:跳转官网 | 5.0.0中文文档 | 快速入门
二、Spring Boot整合Sharding Sphere Proxy
1、安装Sharding Sphere Proxy环境
参考地址:【Docker、Sharding Sphere】Docker安装Sharding Sphere Proxy-5.0.0
2、相关pom.xml依赖
<!-- mysql驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
3、创建Mybatis映射相关文件

注意: @TableName注解中得表名需和代理数据库中得一致

4、application.yml配置
server:
port: 7208

本文介绍了如何在SpringBoot应用中整合ShardingSphereProxy,包括环境安装、依赖配置、Mybatis映射调整、YAML配置和实战测试,展示了如何通过代理实现数据库分片操作。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



