package com.has.shardingjdbcdemo.controller;
import com.has.shardingjdbcdemo.entity.User;
import com.has.shardingjdbcdemo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/sharding/jdbc")
public class ReadWriteController {
@Autowired
private UserMapper userMapper;
@RequestMapping("/testInsert")
public void testInsert(){
User user =new User();
user.setUname("四千年");
userMapper.insert(user);
}
@RequestMapping("/testInsertAndQueryNoTransactional")
public void testInsertandQueryNoTrans(){
User user =new User();
user.setUname("鞠婧祎");
userMapper.insert(user);
List<User> users = userMapper.selectList(null);
}
@Transactional
@RequestMapping("/testInsertAndQueryHasTransactional")
public void testInsertandQueryHasTrans(){
User user =new User();
user.setUname("千年之狐");
userMapper.insert(user);
List<User> users = userMapper.selectList(null);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springboot项目整合sharding-jdbd实现一主二从读写分离项目
共267个文件
xml:247个
class:5个
java:5个
0 下载量 125 浏览量
2022-10-16
00:08:52
上传
评论
收藏 159KB RAR 举报
温馨提示
springboot项目整合sharding-jdbd实现一主二从读写分离项目;主要通过对sharding-jdbc的整合进行快速入门对sharding-jdbc的学习,快速搭建读写分离的项目实战,适合刚刚学习sharding-jdbc的小伙伴们进行入门的实践。
资源详情
资源评论
资源推荐
收起资源包目录
springboot项目整合sharding-jdbd实现一主二从读写分离项目 (267个子文件)
User.class 2KB
ReadWriteController.class 2KB
ShardingJdbcDemoApplication.class 785B
ShardingJdbcDemoApplicationTests.class 583B
UserMapper.class 399B
mvnw.cmd 7KB
.gitignore 395B
.gitignore 184B
sharding-jdbc-demo.iml 29KB
maven-wrapper.jar 57KB
ReadWriteController.java 1KB
User.java 363B
ShardingJdbcDemoApplication.java 349B
UserMapper.java 265B
ShardingJdbcDemoApplicationTests.java 235B
HELP.md 430B
mvnw 10KB
application.properties 2KB
application.properties 2KB
maven-wrapper.properties 233B
workspace.xml 4KB
pom.xml 2KB
compiler.xml 909B
Maven__org_apache_shardingsphere_shardingsphere_cluster_mode_repository_zookeeper_curator_5_1_1.xml 899B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_spring_boot_starter_5_1_1.xml 885B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_distsql_statement_5_1_1.xml 871B
jarRepositories.xml 864B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_distsql_handler_5_1_1.xml 857B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_distsql_parser_5_1_1.xml 850B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_spring_boot_starter_5_1_1.xml 836B
Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml 835B
Maven__org_apache_shardingsphere_shardingsphere_standalone_mode_repository_file_5_1_1.xml 829B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_distsql_statement_5_1_1.xml 822B
Maven__org_apache_shardingsphere_shardingsphere_standalone_mode_repository_api_5_1_1.xml 822B
Maven__org_apache_shardingsphere_shardingsphere_jdbc_spring_boot_starter_infra_5_1_1.xml 822B
Maven__org_apache_shardingsphere_shardingsphere_jdbc_core_spring_boot_starter_5_1_1.xml 815B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_distsql_handler_5_1_1.xml 808B
Maven__org_apache_shardingsphere_shardingsphere_sharding_spring_boot_starter_5_1_1.xml 808B
Maven__org_apache_shardingsphere_shardingsphere_encrypt_spring_boot_starter_5_1_1.xml 801B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_distsql_parser_5_1_1.xml 801B
Maven__org_apache_shardingsphere_shardingsphere_cluster_mode_repository_api_5_1_1.xml 801B
Maven__org_apache_shardingsphere_shardingsphere_shadow_spring_boot_starter_5_1_1.xml 794B
Maven__org_apache_shardingsphere_shardingsphere_sharding_distsql_statement_5_1_1.xml 794B
Maven__org_apache_shardingsphere_shardingsphere_parser_spring_boot_starter_5_1_1.xml 794B
Maven__org_apache_shardingsphere_shardingsphere_infra_federation_optimizer_5_1_1.xml 794B
Maven__org_apache_shardingsphere_shardingsphere_infra_federation_executor_5_1_1.xml 787B
Maven__org_apache_shardingsphere_shardingsphere_encrypt_distsql_statement_5_1_1.xml 787B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_core_5_1_1.xml 780B
Maven__org_apache_shardingsphere_shardingsphere_shadow_distsql_statement_5_1_1.xml 780B
Maven__org_apache_shardingsphere_shardingsphere_sharding_distsql_handler_5_1_1.xml 780B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_error_handler_general_3_0_1.xml 775B
Maven__org_apache_shardingsphere_shardingsphere_readwrite_splitting_api_5_1_1.xml 773B
Maven__org_apache_shardingsphere_shardingsphere_sharding_distsql_parser_5_1_1.xml 773B
Maven__org_apache_shardingsphere_shardingsphere_encrypt_distsql_handler_5_1_1.xml 773B
Maven__org_apache_shardingsphere_shardingsphere_jdbc_transaction_spring_5_1_1.xml 773B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_opengauss_5_1_1.xml 766B
Maven__org_apache_shardingsphere_shardingsphere_encrypt_distsql_parser_5_1_1.xml 766B
Maven__org_apache_shardingsphere_shardingsphere_shadow_distsql_handler_5_1_1.xml 766B
Maven__org_apache_shardingsphere_shardingsphere_shadow_distsql_parser_5_1_1.xml 759B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_postgresql_5_1_1.xml 759B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_opengauss_5_1_1.xml 752B
Maven__org_apache_shardingsphere_shardingsphere_standalone_mode_core_5_1_1.xml 752B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_statement_5_1_1.xml 752B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_sqlserver_5_1_1.xml 752B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_dataflow_executor_3_0_1.xml 747B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_error_handler_spi_3_0_1.xml 747B
Maven__org_apache_shardingsphere_shardingsphere_data_pipeline_core_5_1_1.xml 738B
Maven__org_apache_shardingsphere_shardingsphere_infra_datetime_spi_5_1_1.xml 738B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_mysql_5_1_1.xml 738B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_1.xml 736B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_script_executor_3_0_1.xml 733B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_simple_executor_3_0_1.xml 733B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_executor_kernel_3_0_1.xml 733B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_registry_center_3_0_1.xml 733B
Maven__org_apache_shardingsphere_shardingsphere_data_pipeline_spi_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_core_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_single_table_core_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_cluster_mode_core_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_engine_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_oracle_5_1_1.xml 731B
Maven__org_apache_shardingsphere_shardingsphere_distsql_statement_5_1_1.xml 731B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_lite_lifecycle_3_0_1.xml 726B
Maven__io_netty_netty_transport_native_unix_common_4_1_72_Final.xml 726B
Maven__org_apache_shardingsphere_shardingsphere_single_table_api_5_1_1.xml 724B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_sql92_5_1_1.xml 724B
Maven__org_apache_shardingsphere_shardingsphere_transaction_core_5_1_1.xml 724B
Maven__org_apache_shardingsphere_shardingsphere_memory_mode_core_5_1_1.xml 724B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_mysql_5_1_1.xml 724B
Maven__org_apache_shardingsphere_shardingsphere_db_discovery_api_5_1_1.xml 724B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_http_executor_3_0_1.xml 719B
Maven__org_apache_shardingsphere_shardingsphere_system_datetime_5_1_1.xml 717B
Maven__org_apache_shardingsphere_shardingsphere_transaction_api_5_1_1.xml 717B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_6_2.xml 713B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_infra_common_3_0_1.xml 712B
Maven__org_apache_shardingsphere_shardingsphere_distsql_parser_5_1_1.xml 710B
Maven__org_apache_shardingsphere_shardingsphere_infra_executor_5_1_1.xml 710B
Maven__org_apache_shardingsphere_shardingsphere_authority_core_5_1_1.xml 710B
Maven__org_apache_shardingsphere_shardingsphere_sql_parser_spi_5_1_1.xml 710B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_tracing_api_3_0_1.xml 705B
Maven__org_apache_shardingsphere_elasticjob_elasticjob_tracing_rdb_3_0_1.xml 705B
共 267 条
- 1
- 2
- 3
酒书
- 粉丝: 1453
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0