当前位置:   article > 正文

SpringBoot与shardingsphere分库分表实战,缓存+一致性哈希+分布式面试题_shardingsphere 一致性hash

shardingsphere 一致性hash

com.baomidou

mybatis-plus-boot-starter

${mybatis-plus.version}

org.apache.shardingsphere

sharding-jdbc-spring-boot-starter

${sharding-sphere.version}

org.apache.shardingsphere

sharding-jdbc-spring-namespace

${sharding-sphere.version}

org.projectlombok

lombok

true

org.springframework.boot

spring-boot-starter-test

test

org.springframework.boot

spring-boot-maven-plugin

  • 配置mysql-plus

@Configuration

@MapperScan(“com.github.jianzh5.blog.mapper”)

public class MybatisPlusConfig {

/**

  • 攻击 SQL 阻断解析器

*/

@Bean

public PaginationInterceptor paginationInterceptor(){

PaginationInterceptor paginationInterceptor = new PaginationInterceptor();

List sqlParserList = new ArrayList<>();

sqlParserList.add(new BlockAttackSqlParser());

paginationInterceptor.setSqlParserList(sqlParserList);

return new PaginationInterceptor();

}

/**

  • SQL执行效率插件

*/

@Bean

// @Profile({“dev”,“test”})

public PerformanceInterceptor performanceInterceptor() {

return new PerformanceInterceptor();

}

}

  • 编写实体类Order

@Data

@TableName(“t_order”)

public class Order {

private Long id;

private String name;

private String type;

private Date gmtCreate;

}<

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/757148
推荐阅读
相关标签
  

闽ICP备14008679号