Spring Cloud Alibaba 2025 微服务组件原理与实战
教学版本建议:
- JDK:17+
- Spring Boot:3.5.0
- Spring Cloud:2025.0.0
- Spring Cloud Alibaba:2025.0.0.0
- Nacos:3.0.3
- Sentinel:1.8.9
- Spring Cloud OpenFeign:4.3.x
- Spring Cloud Gateway:4.3.x
学习路线
text
1. 微服务架构认知
↓
2. 项目搭建与版本选择
↓
3. Nacos 服务注册与发现
↓
4. Nacos 配置中心
↓
5. OpenFeign 声明式调用
↓
6. Sentinel 限流熔断
↓
7. Spring Cloud Gateway 网关
↓
8. 全链路上下文透传
↓
9. 综合实战笔记目录
- 微服务架构认知 - 单体与微服务对比,微服务带来的问题
- 项目搭建与版本 - 版本选择、父工程搭建、环境准备
- Nacos 服务注册与发现 - 服务注册、发现、namespace 与 group
- Nacos 配置中心 - 配置管理、动态刷新、共享配置
- OpenFeign 声明式调用 - Feign 接口、参数传递、超时配置
- Sentinel 限流熔断 - 限流规则、熔断降级、Feign 整合
- Spring Cloud Gateway - 路由配置、过滤器、跨域处理
- 全链路上下文透传 - Header 透传、ThreadLocal、Feign 拦截器
- 综合实战 - 完整项目搭建与测试
- 常见问题排查 - 问题排查清单
- 复习提纲 - 核心知识点总结
最终实战架构
text
nacos-server
sentinel-dashboard
gateway-service 网关服务,端口 9000
order-service 订单服务,端口 8081
stock-service 库存服务,端口 8082调用链路:
text
浏览器 / Postman
↓
gateway-service
↓
order-service
↓
OpenFeign
↓
stock-service一句话总结
text
Nacos 解决服务在哪里和配置在哪里;
OpenFeign 解决服务之间怎么优雅调用;
Sentinel 解决流量过大和下游故障时如何保护系统;
Gateway 解决微服务统一入口、路由、过滤、鉴权和上下文透传;
全链路上下文透传解决一次请求在多个服务之间如何保持身份、租户和追踪信息一致。