目录

  • 零、使用前提
  • 一、使用到的组件介绍
  • 二、在公共模块引入依赖
  • 三、 Nacos
  • 四、Feign
  • 五、Gateway网关
  • 六、Sentinel服务容错
  • 七、seata分布式事务
  • 项目地址

零、使用前提

创建个聚合项目,里面每个模块是一个独立的springboot项目

springcloud 版本要与 springboot版本对应,否则会报错
我的版本是:
Spring boot : 2.3.2.RELEASE
spring cloud : Hoxton.SR9
spring cloud alibaba:2.2.5.RELEASE

一、使用到的组件介绍

组件作用
nacos注册中心(服务注册与发现)、配置中心(动态配置管理)
Ribbon负载均衡
Feign声明式Http客户端(调用远程服务)
Sentinel服务容错(限流、降级、熔断)
GatewayAPI网关(webflux编程模式)
Sleuth调用链监控
Seata原Fescar,即分布式事务解决方案

二、在公共模块引入依赖

1、每个微服务项目都会有个公共的模块,用于引一些公用的依赖、配置
2、引入这个依赖,spring-cloud-alibaba 其他的依赖就不用写版本号
3、注意版本号要与springboot版本对应

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.2.5.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

三、 Nacos

Nacos

四、Feign

Feign

五、Gateway网关

Gateway

六、Sentinel服务容错

Sentinel

七、seata分布式事务

Seata

项目地址

git仓库地址:https://gitee/hmb000/spring-cloud-alibaba.git
实例代码在下面几个模块

待补充。。。。。

更多推荐

spring cloud alibaba所有组件(看完即入门)