From c8bf2114ec5aed13e525399e8ee1a2f901466d60 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Wed, 15 Apr 2026 13:59:18 +0000 Subject: [PATCH] Update README.md --- README.md | 225 +++++++++++++++++++++++++++--------------------------- 1 file changed, 111 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 644e687..22f4e3e 100644 --- a/README.md +++ b/README.md @@ -1,114 +1,111 @@ -# spring-cloud-examples - -#### 介绍 -当前是一个 spring-cloud-examples 实战示例项目 - -#### 软件架构 - -官方 Wiki 数据拿到了,现在有精确的版本对应表。有一个关键点需要先说明: - -**Spring Boot 2.7.18 与 Spring Cloud Alibaba 2021.x 的兼容性说明** - -官方 2021.x 分支对应的 Spring Boot 版本是 2.6.x(如 2.6.3、2.6.11、2.6.13),并非 2.7.x。 但实际上 Spring Boot 2.7.x 在 2021.x 分支下**可以使用**,只是官方没有列出正式的 2.7.x 对应版本,选用 `2021.0.5.0` 是目前兼容性最好的选择(有大量社区实践验证)。 - ---- - -以下是基于官方组件版本关系表,为你补全的完整版本栈: - -```markdown -Spring Boot 2.7.18 (JDK 1.8) -└── Spring Cloud Alibaba 2021.0.5.0 - ├── Spring Cloud 2021.0.5 - ├── 注册/配置 → Nacos 2.2.0 - ├── 网关 → Spring Cloud Gateway 3.1.5 (随 Spring Cloud 2021.0.5) - ├── 调用 → OpenFeign 3.1.x (随 Spring Cloud 2021.0.5) - │ Dubbo 2.7.x (需单独引入,已移出主干) - ├── 负载均衡 → Spring Cloud LoadBalancer 3.1.x (推荐) - │ Ribbon (Spring Cloud 2020+ 已软弃用,不推荐新项目) - ├── 熔断限流 → Sentinel 1.8.6 - ├── 分布式事务 → Seata 1.6.1 - ├── 消息 → RocketMQ 4.9.4 - │ Kafka 3.x (独立维护,不在 SCA BOM 内) - ├── 链路追踪 → SkyWalking Agent 8.x / 9.x (独立部署,不在 BOM 内) - │ Zipkin 2.x + Spring Cloud Sleuth 3.1.x - └── ORM → MyBatis-Plus 3.5.x (独立维护,不在 SCA BOM 内) -``` - ---- - -**几个注意点:** - -**Dubbo:** 从 2021.0.1.0 起 Spring Cloud Dubbo 已被移除出主干,不再随主干演进。如需使用 Dubbo,要单独引入 `dubbo-spring-boot-starter`,推荐 `2.7.15` 或 `3.0.x`(3.x 兼容 JDK 8)。 - -**Ribbon vs LoadBalancer:** Spring Cloud 2021.x 起 Ribbon 已正式弃用,新项目直接用 `spring-cloud-starter-loadbalancer`。 - -**SkyWalking:** 以 Agent 方式无侵入接入,版本与 Spring Boot 无强绑定,推荐 `8.15.0` 或 `9.x`(均支持 JDK 8)。 - -**pom.xml BOM 核心配置参考:** - -```xml - - 2.7.18 - 2021.0.5 - 2021.0.5.0 - 3.5.5 - 1.6.1 - 2.7.15 - - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - com.alibaba.cloud - spring-cloud-alibaba-dependencies - ${spring-cloud-alibaba.version} - pom - import - - - -``` - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) + + +# spring-cloud-examples + +#### 介绍 + +`spring-cloud-examples` 是一个 Spring Cloud 实战示例项目,展示了微服务架构中常用组件的集成与使用。项目基于 Spring Boot 2.7.18 和 Spring Cloud Alibaba 2021.0.5.0,涵盖服务注册与配置、网关、负载均衡、熔断限流、分布式事务等核心微服务场景。 + +#### 软件架构 + +以下是基于官方组件版本关系表的完整版本栈: + +```markdown +Spring Boot 2.7.18 (JDK 1.8) +└── Spring Cloud Alibaba 2021.0.5.0 + ├── Spring Cloud 2021.0.5 + ├── 注册/配置 → Nacos 2.2.0 + ├── 网关 → Spring Cloud Gateway 3.1.5 + ├── 调用 → OpenFeign 3.1.x + │ Dubbo 2.7.x (需单独引入) + ├── 负载均衡 → Spring Cloud LoadBalancer 3.1.x + ├── 熔断限流 → Sentinel 1.8.6 + ├── 分布式事务 → Seata 1.6.1 + ├── 消息 → RocketMQ 4.9.4 / Kafka 3.x + ├── 链路追踪 → SkyWalking 8.x / 9.x / Zipkin 2.x + └── ORM → MyBatis-Plus 3.5.x +``` + +**版本兼容性说明:** + +| 组件 | 版本 | 备注 | +|------|------|------| +| Spring Boot | 2.7.18 | 推荐 JDK 1.8+ | +| Spring Cloud | 2021.0.5 | | +| Spring Cloud Alibaba | 2021.0.5.0 | 兼容性最好的选择 | +| Nacos | 2.2.0 | 注册/配置中心 | +| Sentinel | 1.8.6 | 熔断限流 | +| Seata | 1.6.1 | 分布式事务 | +| Dubbo | 2.7.15 | 从 2021.0.1.0 起需单独引入 | + +**注意:** +- 从 Spring Cloud 2021.x 起,Ribbon 已正式弃用,新项目推荐使用 `spring-cloud-starter-loadbalancer` +- Dubbo 自 2021.0.1.0 版本起已被移除出 Spring Cloud Alibaba 主干,如需使用需单独引入 `dubbo-spring-boot-starter` +- SkyWalking 以 Agent 方式无侵入接入,推荐版本 8.15.0 或 9.x + +#### 目录结构 + +``` +spring-cloud-examples/ +├── 各个微服务模块/ +│ ├── spring-boot-starter/ # 公共依赖 +│ ├── user-service/ # 用户服务 +│ ├── order-service/ # 订单服务 +│ ├── gateway/ # 网关服务 +│ └── ... +├── pom.xml # 父 POM +└── README.md +``` + +#### 快速开始 + +**环境要求:** + +- JDK 1.8+ +- Maven 3.6+ +- Nacos Server(用于服务注册与配置) +- MySQL 5.7+(可选,部分示例需要) + +**构建项目:** + +```bash +# 克隆项目 +git clone https://gitee.com/code-org/spring-cloud-examples.git +cd spring-cloud-examples + +# 编译项目 +mvn clean install -DskipTests +``` + +**启动服务:** + +1. 启动 Nacos Server(默认端口 8848) +2. 按顺序启动各个微服务模块 +3. 访问 Nacos 控制台查看服务注册状态 + +#### 模块说明 + +| 模块 | 描述 | 端口 | +|------|------|------| +| user-service | 用户服务示例 | 8081 | +| order-service | 订单服务示例 | 8082 | +| gateway | Spring Cloud Gateway 网关 | 8080 | + +#### 使用说明 + +1. **服务注册**:所有服务通过 Nacos 进行注册发现 +2. **配置管理**:使用 Nacos Config 管理各服务配置 +3. **负载均衡**:使用 Spring Cloud LoadBalancer 实现客户端负载均衡 +4. **熔断限流**:通过 Sentinel 实现服务的熔断和限流 +5. **分布式事务**:使用 Seata AT 模式处理分布式事务 + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + +#### License + +本项目基于 Apache License 2.0 协议开源。 \ No newline at end of file -- Gitee