美文网首页springalibaba
Spring Cloud Alibaba(简介)

Spring Cloud Alibaba(简介)

作者: 不减肥到一百三不改名字 | 来源:发表于2021-03-16 16:08 被阅读0次

    为什么使用SpringCloud Alibaba?

    很多人可能会问,有了spring cloud这个微服务的框架,为什么又要使用spring cloud alibaba这个框架了?最重要的原因在于spring cloud中的几乎所有的组件都使用Netflix公司的产品,然后在其基础上做了一层封装。然而Netflix的服务发现组件Eureka已经停止更新,在使用过程中也存在着细小的问题;由此他的替代产品,也就是spring cloud alibaba,目前正处于蓬勃发展的态式。

    总体结构

    • 微服务:注册中心、配置中心、网关


      image.png

    组件选择

    • 注册中心:SpringCloud Alibaba Nacos
    • 配置中心:SpringCloud Alibaba Nacos
    • 负载均衡:Ribbon
    • 声明式HTTP客户端:SpringCloud Alibaba OpenFegin
    • 服务器容错:SpringCloud Alibaba Sentinel ----限流、降级、熔断
    • API网关:SpringCloud Gateway ----webflux编程模式
    • 调用链路监控:SpringCloud Sleuth
    • 分布式事务:SpringCloud Alibaba Seata ----原Fescar

    组件版本关系

    image.png

    版本选择

    参考:官方

    毕业版本依赖关系(推荐使用)

    image.png

    如何使用

    如何引入依赖

    如果需要使用已发布的版本,在项目pom文件的 dependencyManagement 中添加如下配置。

    <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>
    

    然后再 dependencies 中添加自己所需要的依赖即可。

    相关文章

      网友评论

        本文标题:Spring Cloud Alibaba(简介)

        本文链接:https://www.haomeiwen.com/subject/feedcltx.html