1 Star 0 Fork 0

nofeng囝 / spring-boot-mybatis-sharding-db

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 896 Bytes
一键复制 编辑 原始数据 按行查看 历史
nofeng.zhang 提交于 2020-09-02 10:27 . README.md

spring-boot-mybatis-sharding-db

介绍

springboot应用中使用mybatis进行分库操作的demo

使用说明

1.application.properties 中添加对应的数据库配置,db.config.datasource.db_0 代表分库0,db.config.datasource.db_1 代表分库1。db.config.datasource为固定前缀,db_x为分库的自定义名称,在后续的分库策略中会使用到。 2.定义分库策略,添加分为策略的实现类,实现RepositoryShardingStrategy接口,具体可参考OrderSnSharding

如何配置

Image text

如何配置分库策略

Image text

如何使用

Image text

Java
1
https://gitee.com/gznofeng/spring-boot-mybatis-sharding-db.git
git@gitee.com:gznofeng/spring-boot-mybatis-sharding-db.git
gznofeng
spring-boot-mybatis-sharding-db
spring-boot-mybatis-sharding-db
master

搜索帮助