chenlei2 / Spring Boot Mybatis Rw
Licence: apache-2.0
基于mybatis,springboot开箱即用的读写分离插件
Stars: ✭ 347
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Spring Boot Mybatis Rw
Perseus
⚡️database read and write separation of java
Stars: ✭ 123 (-64.55%)
Mutual labels: transaction, datasource
Dynamic Datasource Spring Boot Starter
dynamic datasource for springboot 多数据源 动态数据源 主从分离 读写分离 分布式事务
Stars: ✭ 3,112 (+796.83%)
Mutual labels: mybatis, datasource
ddal
DDAL(Distributed Data Access Layer) is a simple solution to access database shard.
Stars: ✭ 33 (-90.49%)
Mutual labels: transaction, datasource
Yan
使用Maven构建,整合Dubbo+Zookeeper+SpringMVC+Spring+MyBatis+Redis支持分布式的高效率便捷开发框架
Stars: ✭ 293 (-15.56%)
Mutual labels: mybatis
Dtcollectionviewmanager
Protocol-oriented UICollectionView management, powered by generics and associated types.
Stars: ✭ 300 (-13.54%)
Mutual labels: datasource
Mybatis Log Plugin
Restore mybatis sql log to original whole executable sql.
Stars: ✭ 318 (-8.36%)
Mutual labels: mybatis
Springboot Learning
基于Gradle构建,使用SpringBoot在各个场景的应用,包括集成消息中间件、前后端分离、数据库、缓存、分布式锁、分布式事务等
Stars: ✭ 340 (-2.02%)
Mutual labels: mybatis
Zheng
基于Spring+SpringMVC+Mybatis分布式敏捷开发系统架构,提供整套公共微服务服务模块:集中权限管理(单点登录)、内容管理、支付中心、用户管理(支持第三方登录)、微信平台、存储系统、配置中心、日志分析、任务和通知等,支持服务治理、监控和追踪,努力为中小型企业打造全方位J2EE企业级开发解决方案。
Stars: ✭ 16,163 (+4557.93%)
Mutual labels: mybatis
Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (-6.92%)
Mutual labels: mybatis
Springboot Rabbitmq
RabbitMQ的简单介绍、安装及与SpringBoot整合构建高可用的消息传递方案
Stars: ✭ 320 (-7.78%)
Mutual labels: mybatis
Spring Boot Data Source Decorator
Spring Boot integration with p6spy, datasource-proxy, flexy-pool and spring-cloud-sleuth
Stars: ✭ 295 (-14.99%)
Mutual labels: datasource
Studynotes
📚JAVA、Spring、SpringMVC、SpringBoot、Mybatis、Vue、MySQL、MongoDB、Radis、Docker、Nginx、......笔记
Stars: ✭ 337 (-2.88%)
Mutual labels: mybatis
Sens
基于SpringBoot+MyBatis+Shiro+Redis+ElasticSearch的企业级博客系统
Stars: ✭ 287 (-17.29%)
Mutual labels: mybatis
Mybatipse
Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Stars: ✭ 312 (-10.09%)
Mutual labels: mybatis
Guns
Guns基于SpringBoot 2,致力于做更简洁的后台管理系统,完美整合springmvc + shiro + mybatis-plus + beetl!Guns项目代码简洁,注释丰富,上手容易,同时Guns包含许多基础模块(用户管理,角色管理,部门管理,字典管理等10个模块),可以直接作为一个后台管理系统的脚手架!
Stars: ✭ 3,327 (+858.79%)
Mutual labels: mybatis
spring-boot-mybatis-rw
基于mybatis,springboot开箱即用的读写分离插件
Quick Start
Maven dependency
<dependency>
<groupId>com.github.chenlei2</groupId>
<artifactId>spring-boot-mybatis-rw-starter</artifactId>
<version>0.0.1.releases</version>
</dependency>
介绍
此插件由以下2部分组成
- datasource:读写数据源的代理,支持一写多读,用户只需实现 com.github.chenlei2.springboot.mybatis.rw.starter.datasource.AbstractReadRoutingDataSource这个类,实现自己读数据源的负载均衡算法,默认实现com.github.chenlei2.springboot.mybatis.rw.starter.datasource.impl.RoundRobinRWDataSourceRout
- pulgin:mybatis插件实现读写路由
@Transactional(isolation = Isolation.SERIALIZABLE) 强制本事务都走写库,插件会把事务隔离级别修改为默认隔离级别
spring-boot 配置
spring.mybatis.rw.readDataSources[0].url=jdbc:MySql://localhost:3306/test?characterEncoding=UTF-8
spring.mybatis.rw.readDataSources[0].driverClassName=com.mysql.jdbc.Driver
spring.mybatis.rw.readDataSources[0].username=root
spring.mybatis.rw.readDataSources[0].password=123456
spring.mybatis.rw.readDataSources[1].url=jdbc:MySql://localhost:3306/test?characterEncoding=UTF-8
spring.mybatis.rw.readDataSources[1].driverClassName=com.mysql.jdbc.Driver
spring.mybatis.rw.readDataSources[1].username=root
spring.mybatis.rw.readDataSources[1].password=123456
spring.mybatis.rw.writeDataSource.url=jdbc:MySql://localhost:3306/chenlei?characterEncoding=UTF-8
spring.mybatis.rw.writeDataSource.driverClassName=com.mysql.jdbc.Driver
spring.mybatis.rw.writeDataSource.username=root
spring.mybatis.rw.writeDataSource.password=123456
XML配置
- datasource:
<!--简单的一个master和多个slaver 读写分离的数据源 -->
<bean id="roundRobinRWDataSourceRout"
class="com.github.chenlei2.springboot.mybatis.rw.starter.datasource.impl.RoundRobinRWDataSourceRout">
<property name="writeDataSource" ref="writeDS"/>
<property name="readDataSoures">
<list>
<ref bean="readDS"/>
<ref bean="readDS"/>
<ref bean="readDS"/>
</list>
</property>
</bean>
<bean id="dataSource" class="com.github.chenlei2.springboot.mybatis.rw.starter.datasource.DataSourceProxy">
<constructor-arg ref="roundRobinRWDataSourceRout"/>
</bean>
总结
只需替换数据源,其他配置不变,便实现读写分离,对代码0入侵,配置简单,非常方便老项目的迁移。 详细配置
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].