├── README.md ├── create-routing4db.bat ├── docs ├── Routing4DB使用文档1.0.0.docx ├── Routing4DB使用文档1.0.0.pdf ├── Routing4DB使用文档1.1.0.docx ├── Routing4DB使用文档1.1.0.pdf ├── Routing4DB数据源路由框架设计文档.docx ├── images │ ├── MasterStandbySlaves.jpg │ ├── MutiServerShardTable.jpg │ ├── MutlLevelRouting.jpg │ ├── SingleServerShardTable.jpg │ ├── WriteMasterReadMasterSlaves.jpg │ └── WriteMasterReadSlaves.jpg └── 数据库路由及分库实现方式介绍.docx ├── repository └── com │ └── google │ └── code │ └── routing4db │ └── routing4db │ ├── 1.0.0 │ ├── routing4db-1.0.0-javadoc.jar │ ├── routing4db-1.0.0-sources.jar │ ├── routing4db-1.0.0-sources.jar.md5 │ ├── routing4db-1.0.0-sources.jar.sha1 │ ├── routing4db-1.0.0.jar │ ├── routing4db-1.0.0.jar.md5 │ ├── routing4db-1.0.0.jar.sha1 │ ├── routing4db-1.0.0.pom │ ├── routing4db-1.0.0.pom.md5 │ └── routing4db-1.0.0.pom.sha1 │ ├── 1.1.0 │ ├── routing4db-1.1.0-javadoc.jar │ ├── routing4db-1.1.0-javadoc.jar.md5 │ ├── routing4db-1.1.0-javadoc.jar.sha1 │ ├── routing4db-1.1.0-sources.jar │ ├── routing4db-1.1.0-sources.jar.md5 │ ├── routing4db-1.1.0-sources.jar.sha1 │ ├── routing4db-1.1.0.jar │ ├── routing4db-1.1.0.jar.md5 │ ├── routing4db-1.1.0.jar.sha1 │ ├── routing4db-1.1.0.pom │ ├── routing4db-1.1.0.pom.md5 │ └── routing4db-1.1.0.pom.sha1 │ ├── maven-metadata.xml │ ├── maven-metadata.xml.md5 │ └── maven-metadata.xml.sha1 └── routing4db ├── deploy.bat ├── deploy2.bat ├── eclipse.bat ├── package.bat ├── pom.xml └── src ├── main └── java │ └── com │ └── google │ └── code │ └── routing4db │ ├── datasource │ ├── MasterStrandbyDataSource.java │ └── Routing4DBDataSource.java │ ├── exception │ └── RoutingException.java │ ├── holder │ └── RoutingHolder.java │ ├── mybatis │ └── RoutingMapperFactoryBean.java │ ├── proxy │ ├── RountingProxyFactory.java │ └── RoutingInvocationHanlder.java │ ├── spring │ └── RoutingSpringFactoryBean.java │ ├── strategy │ ├── RoutingStrategy.java │ └── impl │ │ ├── AbstractRoutingStrategy.java │ │ ├── MasterSlaveStrategy.java │ │ ├── ModMasterSlaveRoutingStrategy.java │ │ ├── ModRoutingStrategy.java │ │ ├── NoneRoutingStrategy.java │ │ └── ValidateUtils.java │ └── util │ └── ReflectionUtils.java └── test ├── java └── com │ └── google │ └── code │ └── routing4db │ ├── dao │ ├── User.java │ ├── UserDao.java │ ├── UserDaoImpl.java │ ├── UserDaoJdbcTemplateImpl.java │ ├── UserDaoMybatisImpl.java │ └── UserMapper.java │ ├── example │ ├── ModMasterSlavesTest.java │ ├── ShardDatabaseByModTest.java │ └── WriteMasterReadSlavesTest.java │ ├── mybatis │ └── example │ │ └── MybatisWriteMasterReadSlavesTest.java │ ├── proxy │ └── RountingProxyFactoryTest.java │ ├── standby │ └── MasterStandbyDataSourceTest.java │ └── strategy │ ├── BaseRoutingStrategyTest.java │ ├── MasterSlaveRoutingStrategyTest.java │ ├── ModMasterSlaveRoutingStrategyTest.java │ ├── ModRoutingStrategyTest.java │ └── RandomTest.java └── resources ├── com └── google │ └── code │ └── routing4db │ └── mybatis │ └── example │ └── UserMapper.xml ├── log4j.dtd ├── log4j.xml ├── master-standby.xml ├── mod-master-slaves-example.xml ├── mybatis-config.xml ├── shard-database-by-mod.xml ├── todo-list.txt ├── user.sql ├── write-master-read-slaves-mybatis.xml └── write-master-read-slaves.xml /README.md: -------------------------------------------------------------------------------- 1 | # Routing4DB 2 | 3 | 4 | **Routing4DB** 是由Java实现的基于[接口代理策略](http://gubaojian.blog.163.com/blog/static/166179908201332432825361/)实现的数据源路由框架。通过数据源路由实现以下功能: 5 | 6 | ##### 一、Master-Slave读写分离实现 7 | 8 | 1.1 写Master,读多个Slaves,示意图如下: 9 | 10 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/WriteMasterReadSlaves.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/WriteMasterReadSlaves.jpg) 11 | 12 | 1.2 写Master,读Master和多个Slave,示意图如下 13 | 14 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/WriteMasterReadMasterSlaves.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/WriteMasterReadMasterSlaves.jpg) 15 | 16 | 1.3 Master-Standby-Slaves实现,此方式示意图如下 17 | 18 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MasterStandbySlaves.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MasterStandbySlaves.jpg) 19 | 20 | ##### 二、分库路由功能,构建分布式数据库 21 | 22 | 2.1 单机分库功能,示意图如下: 23 | 24 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/SingleServerShardTable.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/SingleServerShardTable.jpg) 25 | 26 | 2.2 多机集群分库,构建分布式数据库,示意图如下: 27 | 28 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MutiServerShardTable.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MutiServerShardTable.jpg) 29 | 30 | 2.3 高可用多机分布式集群,示意图如下: 31 | 32 | ![https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MutlLevelRouting.jpg](https://raw.githubusercontent.com/gubaojian/routing4db/master/docs/images/MutlLevelRouting.jpg) 33 | 34 | ##### 三、负载均衡 35 | 36 | 37 | ##### 四、自定义数据源路由策略 38 | 39 | 如果框架自带的路由策略不能满足你们要求时,你可以通过的扩展路由接口,自定义路由策略。 40 | 41 | 42 | ##### 五、指定特定数据源 43 | 44 | 45 | ##### 六、支持单数据源事务 46 | 47 | 48 | ##### 七、针对Mybatis的增强功能 49 | 50 | Maven依赖 51 | 52 | 53 | com.google.code.routing4db 54 | routing4db 55 | 1.1.0 56 | 57 | 58 | 59 | routing4db.github.com 60 | https://github.com/gubaojian/routing4db/raw/master/repository 61 | 62 | 63 | 64 | 65 | **[快速入门参考](https://github.com/gubaojian/routing4db/raw/master/docs/Routing4DB%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A31.1.0.pdf)** 66 | 67 | **[Routing4DB设计文档](https://github.com/gubaojian/routing4db/tree/master/docs)** 68 | 69 | 70 | 如果您对此项目,有兴趣欢迎加入或交流讨论。 71 | 72 | 项目贡献者:无花 73 | 74 | 项目作者:谷宝剑 75 | 76 | Email: gubaojian@163.com efurture@gmail.com 77 | 78 | QQ号: 787277208 79 | 80 | -------------------------------------------------------------------------------- /create-routing4db.bat: -------------------------------------------------------------------------------- 1 | call mvn archetype:create -DgroupId=com.google.code.routing4db -DartifactId=routing4db 2 | @pause -------------------------------------------------------------------------------- /docs/Routing4DB使用文档1.0.0.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/Routing4DB使用文档1.0.0.docx -------------------------------------------------------------------------------- /docs/Routing4DB使用文档1.0.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/Routing4DB使用文档1.0.0.pdf -------------------------------------------------------------------------------- /docs/Routing4DB使用文档1.1.0.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/Routing4DB使用文档1.1.0.docx -------------------------------------------------------------------------------- /docs/Routing4DB使用文档1.1.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/Routing4DB使用文档1.1.0.pdf -------------------------------------------------------------------------------- /docs/Routing4DB数据源路由框架设计文档.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/Routing4DB数据源路由框架设计文档.docx -------------------------------------------------------------------------------- /docs/images/MasterStandbySlaves.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/MasterStandbySlaves.jpg -------------------------------------------------------------------------------- /docs/images/MutiServerShardTable.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/MutiServerShardTable.jpg -------------------------------------------------------------------------------- /docs/images/MutlLevelRouting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/MutlLevelRouting.jpg -------------------------------------------------------------------------------- /docs/images/SingleServerShardTable.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/SingleServerShardTable.jpg -------------------------------------------------------------------------------- /docs/images/WriteMasterReadMasterSlaves.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/WriteMasterReadMasterSlaves.jpg -------------------------------------------------------------------------------- /docs/images/WriteMasterReadSlaves.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/images/WriteMasterReadSlaves.jpg -------------------------------------------------------------------------------- /docs/数据库路由及分库实现方式介绍.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/docs/数据库路由及分库实现方式介绍.docx -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-javadoc.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-sources.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-sources.jar.md5: -------------------------------------------------------------------------------- 1 | 508a25ba7ddbf91dfd16ec67b4a50d9a -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0-sources.jar.sha1: -------------------------------------------------------------------------------- 1 | 067c6c51edec222c91093cb1702edc59af4da7b9 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.jar.md5: -------------------------------------------------------------------------------- 1 | 688892d5566b52163973dbb764697daa -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 718d3775b9464d7e55d9c55ef492bfa3d2af79f9 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.pom: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.google.code.routing4db 5 | routing4db 6 | 1.0.0 7 | jar 8 | 9 | routing4db 10 | http://maven.apache.org 11 | 12 | 13 | routing4db.googlecode.com 14 | svn:https://routing4db.googlecode.com/svn/trunk/repository 15 | 16 | 17 | 18 | GBK 19 | GBK 20 | 21 | 22 | 23 | org.springframework 24 | spring-jdbc 25 | 3.1.2.RELEASE 26 | 27 | 28 | org.slf4j 29 | slf4j-api 30 | 1.6.6 31 | 32 | 33 | 34 | org.mybatis 35 | mybatis-spring 36 | 1.2.0 37 | provided 38 | 39 | 40 | 41 | org.slf4j 42 | slf4j-log4j12 43 | 1.6.1 44 | provided 45 | 46 | 47 | log4j 48 | log4j 49 | 1.2.16 50 | provided 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.mybatis 58 | mybatis 59 | 3.2.2 60 | test 61 | 62 | 63 | c3p0 64 | c3p0 65 | 0.9.1.2 66 | test 67 | 68 | 69 | mysql 70 | mysql-connector-java 71 | 5.1.8 72 | test 73 | 74 | 75 | org.springframework 76 | spring-test 77 | 3.2.2.RELEASE 78 | test 79 | 80 | 81 | junit 82 | junit 83 | 4.8 84 | test 85 | 86 | 87 | 88 | Routing4DB-${pom.version} 89 | 90 | 91 | maven-compiler-plugin 92 | 93 | 1.6 94 | 1.6 95 | GBK 96 | 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-source-plugin 101 | 2.1 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-deploy-plugin 106 | 2.5 107 | 108 | 109 | com.google.code.maven-svn-wagon 110 | maven-svn-wagon 111 | 1.4 112 | 113 | 114 | 115 | 116 | 117 | 118 | com.google.code.maven-svn-wagon 119 | maven-svn-wagon 120 | 1.4 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.pom.md5: -------------------------------------------------------------------------------- 1 | 587ac21bbd718350d206bc516d6014e4 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.0.0/routing4db-1.0.0.pom.sha1: -------------------------------------------------------------------------------- 1 | 5024c893cb5e7a35e806faabbe366d737e14ab8c -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-javadoc.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-javadoc.jar.md5: -------------------------------------------------------------------------------- 1 | 3524478df6d2a8601b03239d32600377 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-javadoc.jar.sha1: -------------------------------------------------------------------------------- 1 | 961bc7f10687770bd59105466eb04b987163eda3 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-sources.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-sources.jar.md5: -------------------------------------------------------------------------------- 1 | e864503b0a26709556417758b7f0cd31 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0-sources.jar.sha1: -------------------------------------------------------------------------------- 1 | a3937d0ac34be7d1af6b3c7e7f538aad35ff6904 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.jar -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.jar.md5: -------------------------------------------------------------------------------- 1 | 41bc5a8bff39572b35e965d70b596afd -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.jar.sha1: -------------------------------------------------------------------------------- 1 | e50cbd5a4496fb51f970508b9e79736ccfeb665d -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.pom: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.google.code.routing4db 5 | routing4db 6 | 1.1.0 7 | jar 8 | 9 | routing4db 10 | http://maven.apache.org 11 | 12 | 13 | routing4db.googlecode.com 14 | svn:https://routing4db.googlecode.com/svn/trunk/repository 15 | 16 | 17 | 18 | GBK 19 | GBK 20 | 21 | 22 | 23 | org.springframework 24 | spring-jdbc 25 | 3.1.2.RELEASE 26 | 27 | 28 | org.slf4j 29 | slf4j-api 30 | 1.6.6 31 | 32 | 33 | 34 | org.mybatis 35 | mybatis-spring 36 | 1.2.0 37 | provided 38 | 39 | 40 | 41 | org.slf4j 42 | slf4j-log4j12 43 | 1.6.1 44 | provided 45 | 46 | 47 | log4j 48 | log4j 49 | 1.2.16 50 | provided 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.mybatis 58 | mybatis 59 | 3.2.2 60 | test 61 | 62 | 63 | c3p0 64 | c3p0 65 | 0.9.1.2 66 | test 67 | 68 | 69 | mysql 70 | mysql-connector-java 71 | 5.1.8 72 | test 73 | 74 | 75 | org.springframework 76 | spring-test 77 | 3.2.2.RELEASE 78 | test 79 | 80 | 81 | junit 82 | junit 83 | 4.8 84 | test 85 | 86 | 87 | 88 | Routing4DB-${pom.version} 89 | 90 | 91 | maven-compiler-plugin 92 | 93 | 1.6 94 | 1.6 95 | GBK 96 | 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-source-plugin 101 | 2.1 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-deploy-plugin 106 | 2.5 107 | 108 | 109 | com.google.code.maven-svn-wagon 110 | maven-svn-wagon 111 | 1.4 112 | 113 | 114 | 115 | 116 | 117 | 118 | com.google.code.maven-svn-wagon 119 | maven-svn-wagon 120 | 1.4 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.pom.md5: -------------------------------------------------------------------------------- 1 | b9cabc60a8398097cd65a4f1a754c21a -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/1.1.0/routing4db-1.1.0.pom.sha1: -------------------------------------------------------------------------------- 1 | 76fcb1f1683c691ccac3ab15ca0e457631340879 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.google.code.routing4db 4 | routing4db 5 | 6 | 1.1.0 7 | 8 | 1.0.0 9 | 1.1.0 10 | 11 | 20130808052904 12 | 13 | 14 | -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 587e00c18ceef8274a3a4f33b8d29250 -------------------------------------------------------------------------------- /repository/com/google/code/routing4db/routing4db/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | c929bade48e2cda7034a541694defad2909729dc -------------------------------------------------------------------------------- /routing4db/deploy.bat: -------------------------------------------------------------------------------- 1 | call mvn clean compile package deploy -DperformRelease=true -DupdateReleaseInfo=true -Dmaven.test.skip=true 2 | @pause -------------------------------------------------------------------------------- /routing4db/deploy2.bat: -------------------------------------------------------------------------------- 1 | call mvn deploy -DperformRelease=true -DupdateReleaseInfo=true -Dmaven.test.skip=true 2 | @pause -------------------------------------------------------------------------------- /routing4db/eclipse.bat: -------------------------------------------------------------------------------- 1 | call mvn eclipse:clean 2 | call mvn eclipse:eclipse 3 | @pause; -------------------------------------------------------------------------------- /routing4db/package.bat: -------------------------------------------------------------------------------- 1 | call mvn clean 2 | call mvn package -Dmaven.test.skip=true 3 | @pause -------------------------------------------------------------------------------- /routing4db/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.google.code.routing4db 5 | routing4db 6 | 1.1.0 7 | jar 8 | 9 | routing4db 10 | http://maven.apache.org 11 | 12 | 13 | routing4db.googlecode.com 14 | svn:https://routing4db.googlecode.com/svn/trunk/repository 15 | 16 | 17 | 18 | GBK 19 | GBK 20 | 21 | 22 | 23 | org.springframework 24 | spring-jdbc 25 | 3.1.2.RELEASE 26 | 27 | 28 | org.slf4j 29 | slf4j-api 30 | 1.6.6 31 | 32 | 33 | 34 | org.mybatis 35 | mybatis-spring 36 | 1.2.0 37 | provided 38 | 39 | 40 | 41 | org.slf4j 42 | slf4j-log4j12 43 | 1.6.1 44 | provided 45 | 46 | 47 | log4j 48 | log4j 49 | 1.2.16 50 | provided 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.mybatis 58 | mybatis 59 | 3.2.2 60 | test 61 | 62 | 63 | c3p0 64 | c3p0 65 | 0.9.1.2 66 | test 67 | 68 | 69 | mysql 70 | mysql-connector-java 71 | 5.1.8 72 | test 73 | 74 | 75 | org.springframework 76 | spring-test 77 | 3.2.2.RELEASE 78 | test 79 | 80 | 81 | junit 82 | junit 83 | 4.8 84 | test 85 | 86 | 87 | 88 | Routing4DB-${pom.version} 89 | 90 | 91 | maven-compiler-plugin 92 | 93 | 1.6 94 | 1.6 95 | GBK 96 | 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-source-plugin 101 | 2.1 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-deploy-plugin 106 | 2.5 107 | 108 | 109 | com.google.code.maven-svn-wagon 110 | maven-svn-wagon 111 | 1.4 112 | 113 | 114 | 115 | 116 | 117 | 118 | com.google.code.maven-svn-wagon 119 | maven-svn-wagon 120 | 1.4 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/datasource/MasterStrandbyDataSource.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/datasource/MasterStrandbyDataSource.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/datasource/Routing4DBDataSource.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/datasource/Routing4DBDataSource.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/exception/RoutingException.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.exception; 2 | 3 | public class RoutingException extends RuntimeException{ 4 | private static final long serialVersionUID = 9104194486509552032L; 5 | 6 | public RoutingException() { 7 | super(); 8 | } 9 | 10 | public RoutingException(String message, Throwable cause) { 11 | super(message, cause); 12 | } 13 | 14 | public RoutingException(String message) { 15 | super(message); 16 | } 17 | 18 | public RoutingException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/holder/RoutingHolder.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/holder/RoutingHolder.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/mybatis/RoutingMapperFactoryBean.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/mybatis/RoutingMapperFactoryBean.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/proxy/RountingProxyFactory.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/proxy/RountingProxyFactory.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/proxy/RoutingInvocationHanlder.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/proxy/RoutingInvocationHanlder.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/spring/RoutingSpringFactoryBean.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/spring/RoutingSpringFactoryBean.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/RoutingStrategy.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/RoutingStrategy.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/AbstractRoutingStrategy.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/impl/AbstractRoutingStrategy.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/MasterSlaveStrategy.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/impl/MasterSlaveStrategy.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ModMasterSlaveRoutingStrategy.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ModMasterSlaveRoutingStrategy.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ModRoutingStrategy.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ModRoutingStrategy.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/NoneRoutingStrategy.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.strategy.impl; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | import com.google.code.routing4db.strategy.RoutingStrategy; 6 | 7 | public class NoneRoutingStrategy implements RoutingStrategy { 8 | 9 | public void route(Object target, Method method, Object[] args) { 10 | //DO noting 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ValidateUtils.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/strategy/impl/ValidateUtils.java -------------------------------------------------------------------------------- /routing4db/src/main/java/com/google/code/routing4db/util/ReflectionUtils.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/main/java/com/google/code/routing4db/util/ReflectionUtils.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/User.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.dao; 2 | 3 | public class User { 4 | 5 | private Long id; 6 | 7 | private String name; 8 | 9 | public Long getId() { 10 | return id; 11 | } 12 | 13 | public void setId(Long id) { 14 | this.id = id; 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.dao; 2 | 3 | 4 | 5 | public interface UserDao { 6 | 7 | 8 | public int insert(User user); 9 | 10 | 11 | public User getUserById(long id); 12 | 13 | 14 | 15 | public void insertWithTransaction(User user); 16 | 17 | 18 | public void excludeMethod(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/UserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.dao; 2 | 3 | public class UserDaoImpl implements UserDao{ 4 | 5 | public int insert(User user) { 6 | return 0; 7 | } 8 | 9 | public User getUserById(long id) { 10 | User user = new User(); 11 | user.setId(id); 12 | user.setName("Mock"); 13 | return user; 14 | } 15 | 16 | public void insertWithTransaction(User user) { 17 | } 18 | 19 | @Override 20 | public void excludeMethod() {} 21 | 22 | } 23 | -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/UserDaoJdbcTemplateImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/dao/UserDaoJdbcTemplateImpl.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/UserDaoMybatisImpl.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.dao; 2 | 3 | import org.mybatis.spring.support.SqlSessionDaoSupport; 4 | import org.springframework.transaction.annotation.Transactional; 5 | 6 | public class UserDaoMybatisImpl extends SqlSessionDaoSupport implements UserDao{ 7 | 8 | public int insert(User user) { 9 | return this.getSqlSession().insert("insert", user); 10 | } 11 | 12 | public User getUserById(long id) { 13 | return this.getSqlSession().selectOne("getUserById", id); 14 | } 15 | 16 | @Transactional 17 | public void insertWithTransaction(User user) { 18 | this.getSqlSession().insert("insert", user); 19 | throw new RuntimeException("xxx"); 20 | } 21 | 22 | @Override 23 | public void excludeMethod() {} 24 | 25 | } 26 | -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.dao; 2 | 3 | 4 | 5 | public interface UserMapper extends UserDao { 6 | 7 | 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/example/ModMasterSlavesTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/example/ModMasterSlavesTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/example/ShardDatabaseByModTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/example/ShardDatabaseByModTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/example/WriteMasterReadSlavesTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/example/WriteMasterReadSlavesTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/mybatis/example/MybatisWriteMasterReadSlavesTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/mybatis/example/MybatisWriteMasterReadSlavesTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/proxy/RountingProxyFactoryTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/proxy/RountingProxyFactoryTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/standby/MasterStandbyDataSourceTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/standby/MasterStandbyDataSourceTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/strategy/BaseRoutingStrategyTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/strategy/BaseRoutingStrategyTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/strategy/MasterSlaveRoutingStrategyTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/strategy/MasterSlaveRoutingStrategyTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/strategy/ModMasterSlaveRoutingStrategyTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/strategy/ModMasterSlaveRoutingStrategyTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/strategy/ModRoutingStrategyTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/java/com/google/code/routing4db/strategy/ModRoutingStrategyTest.java -------------------------------------------------------------------------------- /routing4db/src/test/java/com/google/code/routing4db/strategy/RandomTest.java: -------------------------------------------------------------------------------- 1 | package com.google.code.routing4db.strategy; 2 | 3 | import java.util.Random; 4 | 5 | import junit.framework.TestCase; 6 | 7 | import org.springframework.util.PatternMatchUtils; 8 | 9 | public class RandomTest extends TestCase{ 10 | 11 | public void testRandom(){ 12 | Random rand = new Random(); 13 | 14 | for(int i=0; i<10; i++){ 15 | System.out.println(rand.nextInt(2)); 16 | } 17 | 18 | String[] methods = {"selectBy", "select"}; 19 | for(String method : methods){ 20 | String pattern = "*select*"; 21 | // System.out.println(Pattern.matches("\\*select\\*", method)); 22 | } 23 | 24 | System.out.println("xxx*xxx".replaceAll("\\*", "b")); 25 | 26 | 27 | System.out.println(PatternMatchUtils.simpleMatch("*", "a")); 28 | 29 | char ch = 'x'; 30 | 31 | System.out.println(((Character)ch).getClass().getName()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/com/google/code/routing4db/mybatis/example/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | delete from user 11 | where id = #{id,jdbcType=BIGINT} 12 | 13 | 14 | 15 | insert into user (id, name) 16 | values (#{id,jdbcType=BIGINT}, #{name,jdbcType=CHAR}) 17 | 18 | 19 | 20 | insert into user (id, name) 21 | values (#{id,jdbcType=BIGINT}, #{name,jdbcType=CHAR}) 22 | 23 | 24 | 29 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/log4j.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | 65 | 66 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 82 | 83 | 84 | 85 | 86 | 90 | 91 | 92 | 93 | 97 | 98 | 99 | 100 | 101 | 102 | 107 | 108 | 109 | 110 | 111 | 115 | 116 | 117 | 118 | 120 | 121 | 122 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 141 | 142 | 143 | 144 | 146 | 147 | 148 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 167 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/master-standby.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | jdbc:mysql://192.168.56.102:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 10000 68 | 69 | select 1 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/mod-master-slaves-example.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | jdbc:mysql://localhost:3306/test0?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | jdbc:mysql://localhost:3306/test0?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | jdbc:mysql://localhost:3306/test0?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | *get* 158 | *find* 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | excludeMethodPatterns* 173 | *exclude* 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/shard-database-by-mod.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | jdbc:mysql://localhost:3306/test0?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | jdbc:mysql://localhost:3306/test3?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/todo-list.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gubaojian/routing4db/98577b75cf4489cd17eec6c210b8ade4cc32b365/routing4db/src/test/resources/todo-list.txt -------------------------------------------------------------------------------- /routing4db/src/test/resources/user.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `user` ( 2 | `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 3 | `name` CHAR(50) NULL DEFAULT NULL, 4 | PRIMARY KEY (`id`) 5 | ) 6 | COLLATE='utf8_general_ci' 7 | ENGINE=InnoDB 8 | AUTO_INCREMENT=1; -------------------------------------------------------------------------------- /routing4db/src/test/resources/write-master-read-slaves-mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | *get* 104 | *find* 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | excludeMethodPatterns* 122 | *exclude* 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /routing4db/src/test/resources/write-master-read-slaves.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | *get* 101 | *find* 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | excludeMethodPatterns* 122 | *exclude* 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | --------------------------------------------------------------------------------