案例:SpringBoot集成Sharding-JDBC实现分表分库与主从同步(详细版)

案例:SpringBoot集成Sharding-JDBC实现分表分库与主从同步:详细版

  • 1. 案例分析
  • 2. 主从同步
    • 2.1 主从数据库准备
    • 2.2 简单插点数据
  • 3 案例代码
    • 3.1 application.properties配置信息
    • 3.2 测试
  • 4. 遇到的坑
    • 4.1 水平分表时的属性设置
    • 4.2 绑定表的配置

1. 案例分析

表结构:
在这里插入图片描述
垂直分库:STORE_DBPRODUCT_DB
垂直分表:商品表分为:商品信息与商品描述表
水平分库:PRODUCT_DB分为PRODUCT_DB_1PRODUCT_DB_2
水平分表:商品信息与商品描述表1和商品信息与商品描述表2

在这里插入图片描述

2. 主从同步

2.1 主从数据库准备

在这里插入图片描述

主库与从库保持一致,本文案例主要涉及到三个数据库:store_dbproduct_db_1product_db_2

在这里插入图片描述

具体MySQL的主从同步配置,请看我之前的文章。Mysql8.0以上的版本实现主从同步

数据库store_db中的表创建:

DROP TABLE IF EXISTS `region`;
CREATE TABLE `region` (
`id` BIGINT(20) NOT NULL COMMENT 'id',
`region_code` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT
'地理区域编码',
`region_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
COMMENT '地理区域名称',
`level` TINYINT(1) NULL DEFAULT NULL COMMENT '地理区域级别(省、市、县)',
`parent_region_code` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
COMMENT '上级地理区域编码',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = INNODB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `store_info`;

CREATE TABLE `store_info` (
  `id` bigint NOT NULL COMMENT 'id',
  `store_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '店铺名称',
  `reputation` int DEFAULT NULL COMMENT '信誉等级',
  `region_code` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '店铺所在地',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

product_db_1product_db_2结构一样,用于水平分库:

DROP TABLE IF EXISTS `product_descript_1`;
CREATE TABLE `product_descript_1` (
`id` BIGINT(20) NOT NULL COMMENT 'id',
`product_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属商品id',
`descript` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '商品描述',
`store_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属店铺id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `FK_Reference_2`(`product_info_id`) USING BTREE
) ENGINE = INNODB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;


DROP TABLE IF EXISTS `product_descript_2`;
CREATE TABLE `product_descript_2` (
`id` BIGINT(20) NOT NULL COMMENT 'id',
`product_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属商品id',
`descript` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '商品描述',
`store_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属店铺id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `FK_Reference_2`(`product_info_id`) USING BTREE
) ENGINE = INNODB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;


DROP TABLE IF EXISTS `product_info_1`;
CREATE TABLE `product_info_1` (
`product_info_id` BIGINT(20) NOT NULL COMMENT 'id',
`store_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属店铺id',
`product_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
COMMENT '商品名称',
`spec` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规
格',
`region_code` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT
'产地',
`price` DECIMAL(10, 0) NULL DEFAULT NULL COMMENT '商品价格',
`image_url` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT
'商品图片',
PRIMARY KEY (`product_info_id`) USING BTREE,
INDEX `FK_Reference_1`(`store_info_id`) USING BTREE
) ENGINE = INNODB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;


DROP TABLE IF EXISTS `product_info_2`;
CREATE TABLE `product_info_2` (
`product_info_id` BIGINT(20) NOT NULL COMMENT 'id',
`store_info_id` BIGINT(20) NULL DEFAULT NULL COMMENT '所属店铺id',
`product_name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
COMMENT '商品名称',
`spec` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规
格',
`region_code` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT
'产地',
`price` DECIMAL(10, 0) NULL DEFAULT NULL COMMENT '商品价格',
`image_url` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT
'商品图片',
PRIMARY KEY (`product_info_id`) USING BTREE,
INDEX `FK_Reference_1`(`store_info_id`) USING BTREE
) ENGINE = INNODB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;

2.2 简单插点数据

INSERT INTO `region` VALUES (1, '110000', '北京', 0, NULL);
INSERT INTO `region` VALUES (2, '410000', '河南省', 0, NULL);
INSERT INTO `region` VALUES (3, '110100', '北京市', 1, '110000');
INSERT INTO `region` VALUES (4, '410100', '郑州市', 1, '410000');


这里只向region表中插入数据,其他表测试时在搞

3 案例代码

3.1 application.properties配置信息

# Server port
server.port=8080

# Spring Boot 应用属性配置
spring.main.allow-bean-definition-overriding=true
spring.application.name=sharding-jdbc-test-04

# ShardingSphere 数据源配置,总共对应六个主库:m0,m1,m2;从库:s0,s1,s2
spring.shardingsphere.datasource.names=m0,m1,m2,s0,s1,s2

#配置m0连接
spring.shardingsphere.datasource.m0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.m0.url=jdbc:mysql://localhost:3306/store_db?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.m0.username=root
spring.shardingsphere.datasource.m0.password=root

#配置s0连接
spring.shardingsphere.datasource.s0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.s0.url=jdbc:mysql://localhost:3307/store_db?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.s0.username=root
spring.shardingsphere.datasource.s0.password=root

#配置m1连接
spring.shardingsphere.datasource.m1.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.m1.url=jdbc:mysql://localhost:3306/product_db_1?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.m1.username=root
spring.shardingsphere.datasource.m1.password=root

#配置s1连接
spring.shardingsphere.datasource.s1.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.s1.url=jdbc:mysql://localhost:3307/product_db_1?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.s1.username=root
spring.shardingsphere.datasource.s1.password=root

#配置m2连接
spring.shardingsphere.datasource.m2.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m2.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.m2.url=jdbc:mysql://localhost:3306/product_db_2?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.m2.username=root
spring.shardingsphere.datasource.m2.password=root

#配置s2连接
spring.shardingsphere.datasource.s2.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s2.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.s2.url=jdbc:mysql://localhost:3307/product_db_2?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.s2.username=root
spring.shardingsphere.datasource.s2.password=root

# 数据库的主从同步指定
spring.shardingsphere.sharding.master-slave-rules.ds0.master-data-source-name=m0
spring.shardingsphere.sharding.master-slave-rules.ds0.slave-data-source-names=s0
spring.shardingsphere.sharding.master-slave-rules.ds1.master-data-source-name=m1
spring.shardingsphere.sharding.master-slave-rules.ds1.slave-data-source-names=s1
spring.shardingsphere.sharding.master-slave-rules.ds2.master-data-source-name=m2
spring.shardingsphere.sharding.master-slave-rules.ds2.slave-data-source-names=s2


# 设计数据库的分片键:store_info_id以及分片算法,根据{store_info_id%2 +1}可以计算机目标数据库名称
spring.shardingsphere.sharding.default-database-strategy.inline.sharding-column=store_info_id
spring.shardingsphere.sharding.default-database-strategy.inline.algorithm-expression=ds$->{store_info_id%2 +1}

#store_info表的配置
spring.shardingsphere.sharding.tables.store_info.actual-data-nodes=ds$->{0}.store_info
spring.shardingsphere.sharding.tables.store_info.table-strategy.inline.sharding-column=id
spring.shardingsphere.sharding.tables.store_info.table-strategy.inline.algorithm-expression=store_info

#product_info:水平分表设计
spring.shardingsphere.sharding.tables.product_info.actual-data-nodes=ds$->{1..2}.product_info_$->{1..2}
spring.shardingsphere.sharding.tables.product_info.table-strategy.inline.sharding-column=product_info_id
spring.shardingsphere.sharding.tables.product_info.table-strategy.inline.algorithm-expression=product_info_$->{product_info_id%2+1}
spring.shardingsphere.sharding.tables.product_info.key-generator.column=product_info_id
spring.shardingsphere.sharding.tables.product_info.key-generator.type=SNOWFLAKE

#product_descript:水平分表设计
spring.shardingsphere.sharding.tables.product_descript.actual-data-nodes=ds$->{1..2}.product_descript_$->{1..2}
spring.shardingsphere.sharding.tables.product_descript.table-strategy.inline.sharding-column=product_info_id
spring.shardingsphere.sharding.tables.product_descript.table-strategy.inline.algorithm-expression=product_descript_$->{product_info_id%2+1}
spring.shardingsphere.sharding.tables.product_descript.key-generator.column=id
spring.shardingsphere.sharding.tables.product_descript.key-generator.type=SNOWFLAKE


# 绑定关联表:product_info,product_descript
spring.shardingsphere.sharding.binding-tables[0]=product_info,product_descript

#指定广播表region
spring.shardingsphere.sharding.broadcast-tables=region

# 添加日志
spring.shardingsphere.props.sql.show=true


# MyBatis configuration
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:/mapper/*.xml
mybatis.type-aliases-package=com.rql.entity


3.2 测试

在这里插入图片描述

按照数据库表创建各个实体类:
其中ProductInfo是一个模型类,关联了其他表的属性:

package com.rql.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductInfo {

    private Long productInfoId;
    
    
    private Long storeInfoId;
    
    
    private String productName;
    
    
    private String spec;
    
    
    private String regionCode;
    
    
    private BigDecimal price;
    
    
    private String imageUrl;

    //关联信息
    private String descript;

    private String storeName;

    private int reputation;

    private String storeRegionName;

    private String placeOfOrigin;

}


Dao层:

@Mapper
@Component
public interface ProductDao {

    //添加商品基本信息
    @Insert("insert into product_info(store_info_id,product_name,spec,region_code,price)values (#{storeInfoId},#{productName},#{spec},#{regionCode},#{price})")
    @Options(useGeneratedKeys = true,keyProperty = "productInfoId",keyColumn = "product_info_id")
    int insertProductInfo(ProductInfo productInfo);


    //添加商品描述信息
    @Insert("insert into product_descript(product_info_id,descript,store_info_id) values (#{productInfoId},#{descript},#{storeInfoId})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    int insertProductDescript(ProductDescript productDescript);


    //分页查询
    @Select("select i.*,d.descript,r.region_name placeOfOrigin from product_info i join product_descript d on i.product_info_id=d.product_info_id join region r on i.region_code=r.region_code order by product_info_id desc limit #{start},#{pageSize}")
    List<ProductInfo> selectProductList(@Param("start")int start,@Param("pageSize") int pageSize);

    //商品总数
    @Select("select count(1) from product_info")
    int selectCount();

    //商品分组统计
    @Select("select t.region_code,count(1) as num from product_info t group by t.region_code having num>1 order by region_code")
    List<Map> selectProductGroupList();
}

直接在测试类中测试:


@SpringBootTest(classes = SpringBootApplication.class)
@RunWith(SpringRunner.class)
public class ShardingTest {

    @Autowired
    ProductService productService;

    @Autowired
    ProductDao productDao;

    @Test
    public void testCreateProduct() {
        for (int i = 0; i < 10; i++) {
            ProductInfo productInfo = new ProductInfo();
            productInfo.setStoreInfoId(1L);
            productInfo.setProductName("Java编程思想"+i);
            productInfo.setSpec("大号"+i);
            productInfo.setPrice(new BigDecimal(i));
            productInfo.setRegionCode("410100");
            productInfo.setDescript("Java编程思想不错"+i);
            productService.createProduct(productInfo);
        }

    }

    //查询商品
    @Test
    public void testQueryProduct() {
        List<ProductInfo> productInfoList = productService.queryProduct(1,10);
        System.out.println(productInfoList);
    }

    //统计商品总数
    @Test
    public void testSelectCount(){
        System.out.println(productDao.selectCount());
    }

    //商品分组统计
    @Test
    public void testSelectProductGroupList(){
        System.out.println(productDao.selectProductGroupList());
    }
}

4. 遇到的坑

4.1 水平分表时的属性设置

之前我是这样设置的:

spring.shardingsphere.sharding.tables.default.database-strategy.inline.sharding-column=store_info_id
spring.shardingsphere.sharding.tables.default.database-strategy.inline.algorithm-expression=ds$->{store_info_id%2 +1}

结果发现在插入数据时,m1m2数据源均执行了插入过程,而我的目的是根据store_info_id设置的为1,正确的过程应该是只在m2的表中插入数据才对。

解决:原来问题出现在配置的属性上,下面是修改后的属性配置,就成功地解决了上面的问题

spring.shardingsphere.sharding.default-database-strategy.inline.sharding-column=store_info_id
spring.shardingsphere.sharding.default-database-strategy.inline.algorithm-expression=ds$->{store_info_id%2 +1}

可以发现不同在于default.database-strategy改为了default-database-strategy,很明显第一种是不符合Sharding-JDBC的规范的。这种小细节有时候很难发现。

4.2 绑定表的配置

我之前是这样配置的:

spring.shardingsphere.sharding.binding-tables=product_info,product_descript

在进行关联查询时,就会以笛卡尔积的形式去查,这明显是不对的,因此修改后的配置如下:

spring.shardingsphere.sharding.binding-tables[0]=product_info,product_descript

如果还想继续添加绑定,则就继续增加数据即可。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/568493.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

C语言为什么没有应用层开发的库

C语言是一门“古老”的语言了&#xff0c;在中大型的应用层项目开发中&#xff0c;C,Java,Python,C# 等其他编程语言能够更好地胜任&#xff0c;为C语言开发应用层的库简直是费力不讨好&#xff0c;所以几乎没人这么做。在开始前我有一些资料&#xff0c;是我根据网友给的问题精…

退役军人档案管理系统|DW-S403是一套成熟系统

退役军人档案管理系统是一种专门用于管理退役军人档案的信息系统&#xff0c;旨在提高退役军人档案的管理效率和利用价值。该系统采用先进的信息技术手段&#xff0c;对退役军人的档案进行全面、精准、高效的管理&#xff0c;为退役军人的就业、社保、优抚安置等提供有力支持。…

FreeRTOS使用中断相关的函数导致程序卡死解决办法

1.现象 想在串口中断中实现任务通知的功能&#xff0c;所以在串口中断服务函数中使用了xTaskGenericNotifyFromISR&#xff08;&#xff09;函数来发送通知&#xff0c;发现一进入中断服务函数&#xff0c;程序就卡死了。下边是串口初始化和中断服务函数: void Usart_Init_U(…

这届年轻人,对AI对象上头

在AI技术飞速发展的今天&#xff0c;虚拟对象这一概念也流行了起来。从AI女友到AI男友&#xff0c;这些基于人工智能的AI社交应用正在改变我们对情感陪伴的认知。本文深入探讨了AI虚拟对象的兴起、用户需求、商业模式以及技术局限&#xff0c;不妨来看一下。 继2023年文生文大语…

标准版/开源版 移动端新增页面使用文档

在标准版开发的实际使用中&#xff0c;随着用户移动端的产品和信息内容不断增多&#xff0c;新增页面来展示对应的产品详情、模块等内容。针对一些概念或者步骤较多的内容&#xff0c;可以新增子页面构建多级模块结构&#xff0c;帮助用户快速定位。 下面就如何新增页面做一讲…

网际互联及OSI七层模型

1什么是OSI七层模型 2OSI每一个Layer的定义 及用途 3如何使用OSI参考模型分析网络通信过程 一、网际互联 &#xff08;一&#xff09;OSI的概念&#xff1a; open system interconnect开放系统互联参考模型&#xff0c;是有ISO&#xff08;国际标准化组织&#xff09;定义…

混合现实(MR)技术的应用场景

混合现实&#xff08;MR&#xff09;技术将虚拟世界和现实世界融合在一起&#xff0c;用户可以在现实世界中看到和与虚拟物体进行交互&#xff0c;同时还可以感知周围的真实环境。MR技术具有广阔的应用前景&#xff0c;可以应用于各行各业。以下是一些MR的应用场景。北京木奇移…

iOS ------代理 分类 拓展

代理协议 一&#xff0c;概念&#xff1a; 代理&#xff0c;又称委托代理&#xff08;delegate&#xff09;&#xff0c;是iOS中常用的一种设计模式。顾名思义&#xff0c;它是把某个对象要做的事委托给别的对象去做。那么别的对象就是这个对象的代理&#xff0c;代替它来打理…

Linux部署MySQL8.0—手把手保姆级教程

&#x1f469;&#x1f3fd;‍&#x1f4bb;个人主页&#xff1a;阿木木AEcru &#x1f525; 系列专栏&#xff1a;《Docker容器化部署系列》 《Java每日面筋》 &#x1f4b9;每一次技术突破&#xff0c;都是对自我能力的挑战和超越。 目录 一、下载MySQL8.0安装包二、安装MySQ…

springboot的坑

问题&#xff1a;使用Autowired注入一个service&#xff0c;然后写了两个接口&#xff0c;第一个接口与请求时显示注入的service为空一直报错&#xff0c;但是第二个接口请求时service竟然不是空&#xff1f;在这里插入图片描述 凶手找到了&#xff0c;是private修饰。果然没仔…

HTB Runner

Runner User Nmap ──(root㉿kali)-[/home/…/machine/SeasonV/linux/Runner] └─# nmap -A runner.htb -T 4 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-04-22 23:07 EDT Stats: 0:00:01 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Sca…

OpenHarmony实战开发-内存快照Snapshot Profiler功能使用指导。

DevEco Studio集成的DevEco Profiler性能调优工具&#xff08;以下简称为Profiler&#xff09;&#xff0c;提供Time、Allocation、Snapshot、CPU等场景化分析任务类型。内存快照&#xff08;Snapshot&#xff09;是一种用于分析应用程序内存使用情况的工具&#xff0c;通过记录…

鸿蒙OpenHarmony【小型系统运行案例】 (基于Hi3516开发板)

运行 启动系统 在完成Hi3516DV300的烧录后&#xff0c;还需要设置BootLoader引导程序&#xff0c;才能运行OpenHarmony系统。 在Hi3516DV300任务中&#xff0c;单击Configure bootloader&#xff08;Boot OS&#xff09;进行配置即可。 说明&#xff1a; DevEco Device Tool…

【大模型系列】预训练

数据 数据预处理 预处理流程&#xff1a; 原始语料库—>质量过滤&#xff08;语种过滤、统计过滤、关键词过滤、分类器过滤&#xff09;—>敏感内容过滤&#xff08;有毒内容、隐私内容PII&#xff09;—>数据去重&#xff08;句子级别、文档级别、数据集级别&#…

【AI】【Python】pydantic库学习demo

因为工作中学习AI&#xff0c;然后包括看源码&#xff0c;以及看代码都使用到了pydantic库&#xff0c;因此下面是一些最主要的20%&#xff0c;以学会其80%的精髓。 pydantic 库是 python 中用于数据接口定义检查与设置管理的库。 pydantic 在运行时强制执行类型提示&#xff0…

内插和抽取

抽取&#xff1a; 频域表达式的关系&#xff1a; 1、角频率扩大M倍 2、移动2pi、22pi…&#xff08;n-1&#xff09; 2pi 3、相加 4、幅度变为1/M 内插&#xff1a; 加入低通滤波&#xff0c;减小混叠&#xff0c;但是由于截短&#xff0c;也会造成误差&#xff0c;但是…

【MySQL 数据宝典】【磁盘结构】- 004 redolog 重做日志

一、背景介绍 持久性要求&#xff1a; 对于已提交的事务&#xff0c;即使系统发生崩溃&#xff0c;其对数据库的更改也不能丢失。问题&#xff1a; 在事务提交前将所有修改的页面刷新到磁盘浪费资源。随机IO导致刷新速度慢。 解决方案&#xff1a; 【数据副本】记录事务执行过…

[Meachines][Easy]Bizness

Main $ nmap -p- 10.10.11.252 --min-rate 1000 $ dirsearch -u https://bizness.htb/ $ whatweb https://bizness.htb/control/login 存在一个未授权的RCE $ git clone https://github.com/jakabakos/Apache-OFBiz-Authentication-Bypass.git $ cd Apache-OFBiz-Authenticat…

java:观察者模式

java&#xff1a;观察者模式 1 前言 观察者模式&#xff0c;又被称为发布-订阅&#xff08;Publish/Subscribe&#xff09;模式&#xff0c;他定义了一种一对多的依赖关系&#xff0c;让多个观察者对象同时监听某一个主题对象。这个主题对象在状态变化时&#xff0c;会通知所…

Visual Studio2022中使用水晶报表

1.创建水晶报表项目 选择需要的表 自动生成连接 选项&#xff1a;可跳过 后续还有一些 都能跳过 看你自己的需求 自己选的样式 自动生成 查看你的数据源&#xff0c;在选择数据集时已经有啦 不懂得可以看上集 字段可以直接拖&#xff0c;页面上的都是初始化选过的 点击生成 成功…
最新文章