springboot2+两种方式:(读写分离、动态DataSource、事务懒处理)+sharding-jdbc.zip

上传者: 22049773 | 上传时间: 2021-08-03 10:38:55 | 文件大小: 65KB | 文件类型: ZIP
1、AbstractRoutingDataSource (1)、AbstractRoutingDataSource注册多数据源,AOP实现读写分离、读写源自动切换 (2)、一主多从,多个从库的负载均衡策略可以自定义。(双主多从、故障转移因mysql环境为一主一从,所以代码未实现,不难实现,需要实现的代码位置已标记) (3)、非注解方式,业务代码侵入基本为零 (4)、懒事务处理方式,service层使用@Transactional注解的方法或者类只能走默认库(写库) (5)、AOP根据Dao层的方法名来判断读写库的切换,超出判断规则的只能走默认库(写库) 2、sharding-jdbc (1)、实现多种模式的读写分离 (2)、支持事务 (3)、配置中心化 (4)、存储过程不能正常解析 ———————————————— 版权声明:本文为CSDN博主「毛豆有毛没豆」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_22049773/article/details/107237955

文件下载

资源详情

[{"title":"( 95 个子文件 65KB ) springboot2+两种方式:(读写分离、动态DataSource、事务懒处理)+sharding-jdbc.zip","children":[{"title":"10-spring-boot-springmvc-mybatis","children":[{"title":"pom.xml <span style='color:#111;'> 3.20KB </span>","children":null,"spread":false},{"title":".settings","children":[{"title":"org.eclipse.m2e.core.prefs <span style='color:#111;'> 90B </span>","children":null,"spread":false},{"title":"org.eclipse.core.resources.prefs <span style='color:#111;'> 124B </span>","children":null,"spread":false},{"title":"org.eclipse.jdt.core.prefs <span style='color:#111;'> 243B </span>","children":null,"spread":false}],"spread":true},{"title":"src","children":[{"title":"main","children":[{"title":"resources","children":[{"title":"application.yml <span style='color:#111;'> 81B </span>","children":null,"spread":false},{"title":"templates","children":[{"title":"input.html <span style='color:#111;'> 332B </span>","children":null,"spread":false},{"title":"ok.html <span style='color:#111;'> 148B </span>","children":null,"spread":false},{"title":"showUsers.html <span style='color:#111;'> 694B </span>","children":null,"spread":false},{"title":"update.html <span style='color:#111;'> 436B </span>","children":null,"spread":false}],"spread":true},{"title":"application-mybatis-sharding-jdbc.yml <span style='color:#111;'> 1.17KB </span>","children":null,"spread":false},{"title":"log4j.properties <span style='color:#111;'> 2.10KB </span>","children":null,"spread":false},{"title":"application-mybatis.properties <span style='color:#111;'> 3.53KB </span>","children":null,"spread":false},{"title":"mybatis","children":[{"title":"mybatis.cfg.xml <span style='color:#111;'> 2.48KB </span>","children":null,"spread":false},{"title":"mapper","children":[{"title":"user","children":[{"title":"UserMapper.xml <span style='color:#111;'> 795B </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"java","children":[{"title":"com","children":[{"title":"wnd","children":[{"title":"config","children":[{"title":"SpringContextUtils.java <span style='color:#111;'> 2.63KB </span>","children":null,"spread":false},{"title":"DataSourceContextHolder.java <span style='color:#111;'> 1.03KB </span>","children":null,"spread":false},{"title":"DataSourceConfiguration.java <span style='color:#111;'> 1.75KB </span>","children":null,"spread":false},{"title":"DataSourceType.java <span style='color:#111;'> 567B </span>","children":null,"spread":false},{"title":"MyBatisConfiguration.java <span style='color:#111;'> 7.08KB </span>","children":null,"spread":false}],"spread":true},{"title":"aop","children":[{"title":"WriteDataSource.java <span style='color:#111;'> 64B </span>","children":null,"spread":false},{"title":"DataSourceAopInDao.java <span style='color:#111;'> 3.41KB </span>","children":null,"spread":false}],"spread":true},{"title":"pojo","children":[{"title":"User.java <span style='color:#111;'> 296B </span>","children":null,"spread":false}],"spread":true},{"title":"App.java <span style='color:#111;'> 621B </span>","children":null,"spread":false},{"title":"mapper","children":[{"title":"UserMapper.java <span style='color:#111;'> 390B </span>","children":null,"spread":false}],"spread":true},{"title":"controller","children":[{"title":"UserController.java <span style='color:#111;'> 1.65KB </span>","children":null,"spread":false}],"spread":false},{"title":"service","children":[{"title":"UserService.java <span style='color:#111;'> 337B </span>","children":null,"spread":false},{"title":"impl","children":[{"title":"UserServiceImpl.java <span style='color:#111;'> 1.83KB </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"druidFilter","children":[{"title":"DruidMonitorConfig.java <span style='color:#111;'> 1.92KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":".idea","children":[{"title":"codeStyles","children":[{"title":"codeStyleConfig.xml <span style='color:#111;'> 153B </span>","children":null,"spread":false}],"spread":true},{"title":"uiDesigner.xml <span style='color:#111;'> 8.71KB </span>","children":null,"spread":false},{"title":"misc.xml <span style='color:#111;'> 496B </span>","children":null,"spread":false},{"title":"modules.xml <span style='color:#111;'> 323B </span>","children":null,"spread":false},{"title":"10-spring-boot-springmvc-mybatis.iml <span style='color:#111;'> 7.36KB </span>","children":null,"spread":false},{"title":"encodings.xml <span style='color:#111;'> 191B </span>","children":null,"spread":false},{"title":"compiler.xml <span style='color:#111;'> 887B </span>","children":null,"spread":false},{"title":"workspace.xml <span style='color:#111;'> 9.85KB </span>","children":null,"spread":false},{"title":"libraries","children":[{"title":"Maven__com_fasterxml_jackson_core_jackson_annotations_2_10_1.xml <span style='color:#111;'> 675B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_aspects_4_3_12_RELEASE.xml <span style='color:#111;'> 668B </span>","children":null,"spread":false},{"title":"Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_4_RELEASE.xml <span style='color:#111;'> 749B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_log4j_1_3_8_RELEASE.xml <span style='color:#111;'> 758B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_configuration_processor_2_2_2_RELEASE.xml <span style='color:#111;'> 828B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_json_2_2_2_RELEASE.xml <span style='color:#111;'> 751B </span>","children":null,"spread":false},{"title":"Maven__com_alibaba_druid_1_1_10.xml <span style='color:#111;'> 517B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_jdbc_5_2_2_RELEASE.xml <span style='color:#111;'> 640B </span>","children":null,"spread":false},{"title":"Maven__org_slf4j_slf4j_log4j12_1_7_29.xml <span style='color:#111;'> 565B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_webmvc_5_2_2_RELEASE.xml <span style='color:#111;'> 654B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_expression_5_2_2_RELEASE.xml <span style='color:#111;'> 682B </span>","children":null,"spread":false},{"title":"Maven__mysql_mysql_connector_java_8_0_18.xml <span style='color:#111;'> 598B </span>","children":null,"spread":false},{"title":"Maven__org_slf4j_jcl_over_slf4j_1_7_29.xml <span style='color:#111;'> 572B </span>","children":null,"spread":false},{"title":"Maven__com_alibaba_fastjson_1_2_51.xml <span style='color:#111;'> 538B </span>","children":null,"spread":false},{"title":"Maven__org_mybatis_mybatis_spring_1_3_0.xml <span style='color:#111;'> 573B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_tomcat_2_2_2_RELEASE.xml <span style='color:#111;'> 765B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_tx_5_2_2_RELEASE.xml <span style='color:#111;'> 626B </span>","children":null,"spread":false},{"title":"Maven__org_unbescape_unbescape_1_1_6_RELEASE.xml <span style='color:#111;'> 602B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_web_5_2_2_RELEASE.xml <span style='color:#111;'> 633B </span>","children":null,"spread":false},{"title":"Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_29.xml <span style='color:#111;'> 649B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_10_1.xml <span style='color:#111;'> 760B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_jackson_core_jackson_databind_2_10_1.xml <span style='color:#111;'> 654B </span>","children":null,"spread":false},{"title":"Maven__org_slf4j_jul_to_slf4j_1_7_29.xml <span style='color:#111;'> 558B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_jackson_core_jackson_core_2_10_1.xml <span style='color:#111;'> 626B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_2_2_RELEASE.xml <span style='color:#111;'> 786B </span>","children":null,"spread":false},{"title":"Maven__com_zaxxer_HikariCP_3_4_1.xml <span style='color:#111;'> 527B </span>","children":null,"spread":false},{"title":"Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_1_1.xml <span style='color:#111;'> 754B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_jcl_5_2_2_RELEASE.xml <span style='color:#111;'> 633B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_validation_2_2_2_RELEASE.xml <span style='color:#111;'> 793B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_context_5_2_2_RELEASE.xml <span style='color:#111;'> 661B </span>","children":null,"spread":false},{"title":"Maven__org_attoparser_attoparser_2_0_5_RELEASE.xml <span style='color:#111;'> 613B </span>","children":null,"spread":false},{"title":"Maven__jakarta_validation_jakarta_validation_api_2_0_1.xml <span style='color:#111;'> 657B </span>","children":null,"spread":false},{"title":"Maven__org_mybatis_mybatis_3_4_0.xml <span style='color:#111;'> 524B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_2_2_2_RELEASE.xml <span style='color:#111;'> 716B </span>","children":null,"spread":false},{"title":"Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_29.xml <span style='color:#111;'> 635B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_core_5_2_2_RELEASE.xml <span style='color:#111;'> 640B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_10_1.xml <span style='color:#111;'> 719B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_classmate_1_5_1.xml <span style='color:#111;'> 546B </span>","children":null,"spread":false},{"title":"Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_1_1.xml <span style='color:#111;'> 712B </span>","children":null,"spread":false},{"title":"Maven__org_projectlombok_lombok_1_16_10.xml <span style='color:#111;'> 555B </span>","children":null,"spread":false},{"title":"Maven__org_jboss_logging_jboss_logging_3_4_1_Final.xml <span style='color:#111;'> 632B </span>","children":null,"spread":false},{"title":"Maven__org_slf4j_slf4j_api_1_7_29.xml <span style='color:#111;'> 537B </span>","children":null,"spread":false},{"title":"Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml <span style='color:#111;'> 657B </span>","children":null,"spread":false},{"title":"Maven__log4j_log4j_1_2_17.xml <span style='color:#111;'> 493B </span>","children":null,"spread":false},{"title":"Maven__org_yaml_snakeyaml_1_25.xml <span style='color:#111;'> 519B </span>","children":null,"spread":false},{"title":"Maven__org_hibernate_validator_hibernate_validator_6_0_18_Final.xml <span style='color:#111;'> 705B </span>","children":null,"spread":false},{"title":"Maven__org_thymeleaf_thymeleaf_spring5_3_0_11_RELEASE.xml <span style='color:#111;'> 665B </span>","children":null,"spread":false},{"title":"Maven__org_aspectj_aspectjweaver_1_9_5.xml <span style='color:#111;'> 566B </span>","children":null,"spread":false},{"title":"Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_10_1.xml <span style='color:#111;'> 705B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_beans_5_2_2_RELEASE.xml <span style='color:#111;'> 647B </span>","children":null,"spread":false},{"title":"Maven__com_alibaba_druid_spring_boot_starter_1_1_10.xml <span style='color:#111;'> 657B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_autoconfigure_2_2_2_RELEASE.xml <span style='color:#111;'> 758B </span>","children":null,"spread":false},{"title":"Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_29.xml <span style='color:#111;'> 684B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_jdbc_2_2_2_RELEASE.xml <span style='color:#111;'> 751B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_spring_aop_4_3_12_RELEASE.xml <span style='color:#111;'> 640B </span>","children":null,"spread":false},{"title":"Maven__org_thymeleaf_thymeleaf_3_0_11_RELEASE.xml <span style='color:#111;'> 609B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_2_2_2_RELEASE.xml <span style='color:#111;'> 660B </span>","children":null,"spread":false},{"title":"Maven__org_springframework_boot_spring_boot_starter_web_2_2_2_RELEASE.xml <span style='color:#111;'> 744B </span>","children":null,"spread":false}],"spread":false},{"title":"inspectionProfiles","children":[{"title":"Project_Default.xml <span style='color:#111;'> 290B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明