SpringBoot+ShardingSphereJDBC實(shí)現(xiàn)讀寫(xiě)分離詳情
1 概述
本文講述了如何使用MyBatisPlus+ShardingSphereJDBC進(jìn)行讀寫(xiě)分離,以及利用MySQL進(jìn)行一主一從的主從復(fù)制。
具體步驟包括:
MySQL主從復(fù)制環(huán)境準(zhǔn)備(Docker)- 搭建
ShardingShpereJDBC+MyBatisPlus+Druid環(huán)境 - 測(cè)試
2 環(huán)境
OpenJDK 17.0.3Spring Boot 2.7.0MyBatis Plus 3.5.1MyBatis Plus Generator 3.5.2Druid 1.2.10ShardingSphereJDBC 5.1.1MySQL 8.0.29(Docker)
3 一些基礎(chǔ)理論
3.1 讀寫(xiě)分離
讀寫(xiě)分離,顧名思義就是讀和寫(xiě)分開(kāi),更具體來(lái)說(shuō),就是:
- 寫(xiě)操作在主數(shù)據(jù)庫(kù)進(jìn)行
- 讀操作在從數(shù)據(jù)庫(kù)進(jìn)行
使用讀寫(xiě)分離的根本目的就是為了提高并發(fā)性能,如果讀寫(xiě)都在同一臺(tái)MySQL上實(shí)現(xiàn),相信會(huì)不如一臺(tái)MySQL寫(xiě),另外兩臺(tái)MySQL讀這樣的配置性能高。另一方面,在很多時(shí)候都是讀操作的請(qǐng)求要遠(yuǎn)遠(yuǎn)高于寫(xiě)操作,這樣就顯得讀寫(xiě)分離非常有必要了。
3.2 主從復(fù)制
主從復(fù)制,顧名思義就是把主庫(kù)的數(shù)據(jù)復(fù)制到從庫(kù)中,因?yàn)樽x寫(xiě)分離之后,寫(xiě)操作都在主庫(kù)進(jìn)行,但是讀操作是在從庫(kù)進(jìn)行的,也就是說(shuō),主庫(kù)上的數(shù)據(jù)如果不能復(fù)制到從庫(kù)中,那么從庫(kù)就不會(huì)讀到主庫(kù)中的數(shù)據(jù)。嚴(yán)格意義上說(shuō),讀寫(xiě)分離并不要求主從復(fù)制,只需要在主庫(kù)寫(xiě)從庫(kù)讀即可,但是如果沒(méi)有了主從復(fù)制,讀寫(xiě)分離將失去了它的意義。因此讀寫(xiě)分離通常與主從復(fù)制配合使用。
因?yàn)楸臼纠褂玫氖?code>MySQL,這里就說(shuō)一下MySQL主從復(fù)制的原理,如下圖所示:

工作流程如下:
- 主庫(kù)修改數(shù)據(jù)后,將修改日志寫(xiě)入
binlog - 從庫(kù)的
I/O線(xiàn)程讀取主庫(kù)的binlog,并拷貝到從庫(kù)本地的binlog中 - 從庫(kù)本地的
binlog被SQL線(xiàn)程讀取,執(zhí)行其中的內(nèi)容并同步到從庫(kù)中
3.3 數(shù)據(jù)庫(kù)中間件簡(jiǎn)介
數(shù)據(jù)庫(kù)中間件可以簡(jiǎn)化對(duì)讀寫(xiě)分離以及分庫(kù)分表的操作,并隱藏底層實(shí)現(xiàn)細(xì)節(jié),可以像操作單庫(kù)單表那樣操作多庫(kù)多表,主流的設(shè)計(jì)方案主要有兩種:
- 服務(wù)端代理:需要獨(dú)立部署一個(gè)代理服務(wù),該代理服務(wù)后面管理多個(gè)數(shù)據(jù)庫(kù)實(shí)例,在應(yīng)用中通過(guò)一個(gè)數(shù)據(jù)源與該代理服務(wù)器建立連接,由該代理去操作底層數(shù)據(jù)庫(kù),并返回相應(yīng)結(jié)果。優(yōu)點(diǎn)是支持多語(yǔ)言,對(duì)業(yè)務(wù)透明,缺點(diǎn)是實(shí)現(xiàn)復(fù)雜,實(shí)現(xiàn)難度大,同時(shí)代理需要確保自身高可用
- 客戶(hù)端代理:在連接池或數(shù)據(jù)庫(kù)驅(qū)動(dòng)上進(jìn)行一層封裝,內(nèi)部與不同的數(shù)據(jù)庫(kù)建立連接,并對(duì)
SQL進(jìn)行必要的操作,比如讀寫(xiě)分離選擇走主庫(kù)還是從庫(kù),分庫(kù)分表select后如何聚合結(jié)果。優(yōu)點(diǎn)是實(shí)現(xiàn)簡(jiǎn)單,天然去中心化,缺點(diǎn)是支持語(yǔ)言較少,版本升級(jí)困難
一些常見(jiàn)的數(shù)據(jù)庫(kù)中間件如下:
Cobar:阿里開(kāi)源的關(guān)系型數(shù)據(jù)庫(kù)分布式服務(wù)中間件,已停更DRDS:脫胎于Cobar,全稱(chēng)分布式關(guān)系型數(shù)據(jù)庫(kù)服務(wù)MyCat:開(kāi)源數(shù)據(jù)庫(kù)中間件,目前更新了MyCat2版本Atlas:Qihoo 360公司Web平臺(tái)部基礎(chǔ)架構(gòu)團(tuán)隊(duì)開(kāi)發(fā)維護(hù)的一個(gè)基于MySQL協(xié)議的數(shù)據(jù)中間層項(xiàng)目,同時(shí)還有一個(gè)NoSQL的版本,叫Pikatddl:阿里巴巴自主研發(fā)的分布式數(shù)據(jù)庫(kù)服務(wù)Sharding-JDBC:ShardingShpere的一個(gè)子產(chǎn)品,一個(gè)輕量級(jí)Java框架
4MySQL主從復(fù)制環(huán)境準(zhǔn)備
看完了一些基礎(chǔ)理論就可以進(jìn)行動(dòng)手了,本小節(jié)先準(zhǔn)備好MySQL主從復(fù)制的環(huán)境,基于Docker+MySQL官方文檔搭建。
4.1 主庫(kù)操作
4.1.1 拉取鏡像并創(chuàng)建容器運(yùn)行
docker pull mysql docker run -itd -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 --name master mysql docker exec -it master /bin/bash
在主庫(kù)中進(jìn)行更新鏡像源,安裝vim以及net-tools的操作:
cd /etc/apt echo deb http://mirrors.aliyun.com/debian/ buster main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib deb http://mirrors.aliyun.com/debian-security buster/updates main deb-src http://mirrors.aliyun.com/debian-security buster/updates main deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib > sources.list apt update && apt upgrade apt install vim net-tools
4.1.2 修改配置文件
vim /etc/mysql/my.cnf
添加下面兩行數(shù)據(jù):
[mysqld] server-id=1 # 全局唯一,取值[1,2^32-1],默認(rèn)為1 binlog-do-db=test # 表示需要復(fù)制的是哪個(gè)庫(kù)
修改完成后重啟。
4.1.3 準(zhǔn)備數(shù)據(jù)源
CREATE DATABASE test; USE test; CREATE TABLE user( id BIGINT PRIMARY KEY, name VARCHAR(30) NOT NULL, );
4.1.4 創(chuàng)建一個(gè)復(fù)制操作的用戶(hù)(可選但推薦)
注意創(chuàng)建用戶(hù)需要加上mysql_native_password,否則會(huì)導(dǎo)致從庫(kù)一直處于連接狀態(tài):
CREATE USER 'repl'@'172.17.0.3' IDENTIFIED WITH mysql_native_password BY '123456'; GRANT REPLICATION slave ON *.* TO 'repl'@'172.17.0.3';
具體的地址請(qǐng)根據(jù)從庫(kù)的地址修改,可以先看后面的從庫(kù)配置部分。
4.1.5 數(shù)據(jù)備份(可選)
如果原來(lái)的主庫(kù)中是有數(shù)據(jù)的,那么這部分?jǐn)?shù)據(jù)需要手動(dòng)同步到從庫(kù)中:
FLUSH TABLES WITH READ LOCK;
開(kāi)啟主庫(kù)的另一個(gè)終端,使用mysqldump導(dǎo)出:
mysqldump -u root -p --all-databases --master-data > dbdump.db
導(dǎo)出完成后,解除讀鎖:
UNLOCK TABLES;
4.1.6 查看主庫(kù)狀態(tài)
SHOW MASTER STATUS;

需要把File以及Position記錄下來(lái),后面從庫(kù)的配置需要用到。
4.2 從庫(kù)操作
4.2.1 拉取鏡像并創(chuàng)建容器運(yùn)行
docker pull mysql docker run -itd -p 3307:3306 -e MYSQL_ROOT_PASSWORD=123456 --name slave mysql docker exec -it slave /bin/bash
進(jìn)入容器后,像主庫(kù)一樣更新源然后安裝vim和net-tools:
cd /etc/apt echo deb http://mirrors.aliyun.com/debian/ buster main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib deb http://mirrors.aliyun.com/debian-security buster/updates main deb-src http://mirrors.aliyun.com/debian-security buster/updates main deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib > sources.list apt update && apt upgrade apt install vim net-tools
4.2.2 修改配置文件
vim /etc/mysql/my.cnf
添加如下兩行:
[mysqld] server-id=2 # 全局唯一,不能與主庫(kù)相同 replicate-do-db=test # 與主庫(kù)相同,表示對(duì)該庫(kù)進(jìn)行復(fù)制
修改完成后重啟。
4.2.3 查看ip地址
查看從庫(kù)的ip地址,用于給主庫(kù)設(shè)置同步的用戶(hù):
ifconfig
輸出:
inet 172.17.0.3 netmask 255.255.0.0 broadcast 172.17.255.255
那么主庫(kù)中用于復(fù)制的用戶(hù)就可以是repl@172.17.0.3。
4.2.4 導(dǎo)入數(shù)據(jù)(可選)
如果主庫(kù)有數(shù)據(jù)可以先導(dǎo)入到從庫(kù):
mysqldump -u root -p --all-databases < dbdump.db
4.2.5 準(zhǔn)備數(shù)據(jù)源
CREATE DATABASE test; USE test; CREATE TABLE user( id BIGINT PRIMARY KEY, name VARCHAR(30) NOT NULL, );
4.2.6 設(shè)置主庫(kù)
可以使用change master to/change replication source to(8.0.23+)命令:
CHANGE REPLICATION SOURCE TO source_host='172.17.0.2', # 可以使用ifconfig查看主庫(kù)ip source_user='repl', # 之前主庫(kù)創(chuàng)建的用戶(hù) source_password='123456', # 密碼 source_log_file='binlog.000003', # 之前在主庫(kù)上使用show master status查看的日志文件 source_log_pos=594; # 同樣使用show master status查看
4.2.7 開(kāi)啟從庫(kù)
START SLAVE; SHOW SLAVE STATUS\G
新版本(8.0.22+)可使用:
START REPLICA; SHOW REPLICA STATUS\G
需要IO和SQL線(xiàn)程顯示Yes才算成功:

4.3 測(cè)試
主庫(kù)選擇插入一條數(shù)據(jù):
INSERT INTO user VALUES(1,"name",3);
然后從庫(kù)就能select到了:

5 搭建Spring Boot環(huán)境
5.1 新建項(xiàng)目并引入依賴(lài)
新建Spring Boot項(xiàng)目,并引入如下依賴(lài):
implementation 'com.alibaba:druid:1.2.10' implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.1' implementation 'org.freemarker:freemarker:2.3.31' implementation 'com.baomidou:mybatis-plus-generator:3.5.2' implementation 'org.apache.shardingsphere:shardingsphere-jdbc-core-spring-boot-starter:5.1.1'
Maven版本:
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.1</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>3.5.2</version> </dependency> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.31</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.2.10</version> </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>sharding-jdbc-spring-boot-starter</artifactId> <version>5.1.1</version> </dependency>
5.2 使用生成器
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
public class Generator {
public static void main(String[] args){
FastAutoGenerator.create("jdbc:mysql://localhost:3306/test", "root", "123456")
.globalConfig(builder ->
builder.author("author").outputDir(System.getProperty("user.dir") + "/src/main/java").build())
.packageConfig(builder ->
builder.parent("com.example.demo").moduleName("user").build())
.strategyConfig(builder ->
builder.addInclude("user").entityBuilder().enableLombok().disableSerialVersionUID().build())
.templateEngine(new FreemarkerTemplateEngine())
.execute();
}
}直接運(yùn)行main方法即可生成代碼,配置請(qǐng)根據(jù)個(gè)人需要進(jìn)行更改。
5.3 配置文件
spring: shardingsphere: mode: type: Memory # 內(nèi)存模式,元數(shù)據(jù)保存在當(dāng)前進(jìn)程中 datasource: names: master,slave # 數(shù)據(jù)源名稱(chēng),這里有兩個(gè) master: # 跟上面的數(shù)據(jù)源對(duì)應(yīng) type: com.alibaba.druid.pool.DruidDataSource # 連接池 url: jdbc:mysql://127.0.0.1:3306/test # 連接url username: root password: 123456 slave: # 跟上面的數(shù)據(jù)源對(duì)應(yīng) type: com.alibaba.druid.pool.DruidDataSource url: jdbc:mysql://127.0.0.1:3306/test username: root password: 123456 rules: readwrite-splitting: # 讀寫(xiě)分離規(guī)則 data-sources: # 數(shù)據(jù)源配置 random: # 這個(gè)名字隨便起 type: Static # 靜態(tài)類(lèi)型 load-balancer-name: round_robin # 負(fù)載均衡算法名字 props: write-data-source-name: master # 寫(xiě)數(shù)據(jù)源 read-data-source-names: slave # 讀數(shù)據(jù)源 load-balancers: # 負(fù)載均衡配置 round_robin: # 跟上面負(fù)載均衡算法的名字對(duì)應(yīng) type: ROUND_ROBIN # 負(fù)載均衡算法 props: sql-show: true # 打印SQL
因?yàn)榕渲梦募膬?nèi)容比較多,以下進(jìn)行分開(kāi)說(shuō)明。
5.3.1 模式
spring.shardingsphere.mode.type,模式有三種:
Memory:內(nèi)存模式,初始化配置或執(zhí)行SQL等操作均在當(dāng)前進(jìn)程生效Standalone:?jiǎn)螜C(jī)模式,可以將數(shù)據(jù)源和規(guī)則等元數(shù)據(jù)信息持久化,但是這些元數(shù)據(jù)不會(huì)在集群中同步Cluster:集群模式,提供了多個(gè)Apache ShardingSphere實(shí)例之間元數(shù)據(jù)共享以及分布式場(chǎng)景下的狀態(tài)協(xié)調(diào)的能力,也提供水平擴(kuò)展以及高可用的能力
這里使用內(nèi)存模式,如果想將元數(shù)據(jù)等信息持久化,請(qǐng)使用單機(jī)模式,單機(jī)模式需要配置以下屬性:
- spring.shardingsphere.mode.type=Standalone:設(shè)置單機(jī)模式
- spring.shardingsphere.mode.repository.type=:持久化倉(cāng)庫(kù)的類(lèi)型,單機(jī)模式適用類(lèi)型為File
- spring.shardingsphere.mode.repository.props.path=:元數(shù)據(jù)存儲(chǔ)路徑,默認(rèn).shardingsphere
- spring.shardingsphere.mode.overwrite=:是否覆蓋
而采用集群模式,需要配置以下屬性:
- spring.shardingsphere.mode.type=Cluster:設(shè)置集群模式
- spring.shardingsphere.mode.repository.type=:持久化倉(cāng)庫(kù)類(lèi)型,集群模式支持ZooKeeper以及Etcd持久化
- spring.shardingsphere.mode.repository.props.namespace=:注冊(cè)中心命名空間
- spring.shardingsphere.mode.repository.props.server-lists=:注冊(cè)中心服務(wù)器列表
- spring.shardingsphere.mode.overwrite=:是否覆蓋
- spring.shardingsphere.mode.repository.props.<key>=:注冊(cè)中心的屬性配置,對(duì)于ZooKeeper,可以配置retryIntervalMilliseconds(重試間隔毫秒)、maxRetries(客戶(hù)端連接最大重試數(shù))、timeToLiveSeconds(臨時(shí)數(shù)據(jù)存活秒數(shù))、operationTimeoutMilliseconds(客戶(hù)端操作超時(shí)毫秒數(shù))、digest(登錄密碼),對(duì)于Etcd,可以配置timeToLiveSeconds(臨時(shí)數(shù)據(jù)存活秒數(shù))、connectionTimeout(連接超時(shí)秒數(shù))
5.3.2 數(shù)據(jù)源配置
spring.shardingsphere.datasource.names,后面接數(shù)據(jù)源的名稱(chēng),使用,分隔,比如此處有兩個(gè)數(shù)據(jù)源:
masterslave
然后每個(gè)數(shù)據(jù)源可以配置:
type:數(shù)據(jù)庫(kù)連接池類(lèi)型,這里使用的是Druidusername:用戶(hù)名password:密碼jdbc-url:連接url,注意,對(duì)于此處使用的Druid連接池,需要使用url而不是jdbc-url
5.3.3 讀寫(xiě)分離規(guī)則配置
spring.shardingsphere.rules.readwrite-splitting,需要配置其中的數(shù)據(jù)源以及負(fù)載均衡類(lèi)型:
- spring.shardingsphere.rules.readwrite-splitting.data-sources
- spring.shardingsphere.rules.readwrite-splitting.load-balancers
5.3.3.1 數(shù)據(jù)源配置
數(shù)據(jù)源配置首先需要添加一個(gè)數(shù)據(jù)源的名字,隨便起一個(gè),比如這里是random,然后需要配置三個(gè)屬性:
- spring.shardingsphere.rules.readwrite-splitting.data-sources.random.type:讀寫(xiě)分離的類(lèi)型,可選值為Static與Dynamic,這里選擇Static,如果選擇Dynamic,也就是動(dòng)態(tài)數(shù)據(jù)源,請(qǐng)配合dynamic-datasource-spring-boot-starter使用
- spring.shardingsphere.rules.readwrite-splitting.data-sources.random.props.write-data-source-name:寫(xiě)數(shù)據(jù)源
- spring.shardingsphere.rules.readwrite-splitting.data-sources.random.props.read-data-source-name:讀數(shù)據(jù)源
- spring.shardingsphere.rules.readwrite-splitting.data-sources.random.load-balancer-name:負(fù)載均衡算法的名稱(chēng),這里寫(xiě)的是round_robin
5.3.3.2 負(fù)載均衡配置
負(fù)載均衡配置需要與上面的spring.shardingsphere.rules.readwrite-splitting.data-sources.random.load-balancer-name屬性對(duì)應(yīng),比如這里是round_robin,那么需要配置的就是spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin。然后下一步就是配置具體的負(fù)載均衡算法。
內(nèi)置的負(fù)載均衡算法有三個(gè):
- 輪詢(xún)算法:
ROUND_ROBIN,配置type=ROUND_ROBIN即可,也就是spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin.type=ROUND_ROBIN - 隨機(jī)訪問(wèn)算法:
RANDOM,配置type=RANDOM - 權(quán)重訪問(wèn)算法:
WEIGHT,配置type=WEIGHT,同時(shí)需要配置props,在其中配置各個(gè)讀節(jié)點(diǎn)的權(quán)重
5.3.4 屬性配置
屬性的話(huà)這里只配置了一個(gè)spring.shardingsphere.props.sql-show=true,也就是打印SQL,其他支持的屬性有:
- spring.shardingsphere.props.sql-simple:是否打印簡(jiǎn)單風(fēng)格的SQL,默認(rèn)為false
- spring.shardingsphere.props.kernel-exector-size:設(shè)置任務(wù)處理線(xiàn)程池大小,默認(rèn)為infinite
- spring.shardingsphere.props.max-connections-size-per-query:每次查詢(xún)所能使用的最多數(shù)據(jù)庫(kù)連接數(shù),默認(rèn)為1
- spring.shardingsphere.props.check-table-metadata-enabled:啟動(dòng)時(shí)是否檢查分片元數(shù)據(jù)的一致性,默認(rèn)為false
- spring.shardingsphere.props.check-duplicate-table-enabled:啟動(dòng)時(shí)是否檢查重復(fù)表,默認(rèn)為false
- spring.shardingsphere.props.sql-federation-enabled:是否開(kāi)啟聯(lián)邦查詢(xún),默認(rèn)為false
5.4 準(zhǔn)備Controller
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController {
private final UserServiceImpl userService;
@GetMapping("/select")
public User select(){
return userService.getById(1);
}
@GetMapping("/insert")
public boolean insert(){
return userService.saveOrUpdate(User.builder().id(3L).name("name3").build());
}
}6 測(cè)試
訪問(wèn)http://localhost:8080/user/insert,可以看到寫(xiě)操作在主庫(kù)進(jìn)行:

訪問(wèn)http://localhost:8080/user/select,可以看到讀操作在從庫(kù)進(jìn)行:

這樣讀寫(xiě)分離就算是完成了。
到此這篇關(guān)于SpringBoot+ShardingSphereJDBC實(shí)現(xiàn)讀寫(xiě)分離詳情的文章就介紹到這了,更多相關(guān)SpringBoot讀寫(xiě)分離內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Java輸入數(shù)據(jù)的知識(shí)點(diǎn)整理
在本篇文章里小編給大家整理的是關(guān)于Java如何輸入數(shù)據(jù)的相關(guān)知識(shí)點(diǎn)內(nèi)容,有興趣的朋友們學(xué)習(xí)參考下。2020-01-01
java?poi導(dǎo)入純數(shù)字等格式問(wèn)題及解決
這篇文章主要介紹了java?poi導(dǎo)入純數(shù)字等格式問(wèn)題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-03-03
java char數(shù)據(jù)類(lèi)型原理解析
這篇文章主要介紹了java char數(shù)據(jù)類(lèi)型原理解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-02-02
JSON for java快速入門(mén)總結(jié)學(xué)習(xí)
這篇文章主要介紹了JSON for java入門(mén)總結(jié)學(xué)習(xí),有需要的可以了解一下。2016-11-11
詳解Java中ThreadLocal類(lèi)型及簡(jiǎn)單用法
ThreadLocal實(shí)例通常是希望將狀態(tài)與線(xiàn)程關(guān)聯(lián)起來(lái)的類(lèi)中的私有靜態(tài)字段,下面通過(guò)例子給大家詳細(xì)介紹Java中ThreadLocal類(lèi)型及簡(jiǎn)單用法,感興趣的朋友跟隨小編一起看看吧2021-10-10
Prometheus 入門(mén)教程之SpringBoot 實(shí)現(xiàn)自定義指標(biāo)監(jiān)控
這篇文章主要介紹了Prometheus 入門(mén)教程之SpringBoot 實(shí)現(xiàn)自定義指標(biāo)監(jiān)控,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-12-12
java 中Comparable與Comparator詳解與比較
這篇文章主要介紹了java 中Comparable與Comparator詳解與比較的相關(guān)資料,需要的朋友可以參考下2017-04-04

