SpringCloud Alibaba微服务工具集

1、SpringCloud Alibaba简介

1.1spring cloud alibaba 概述

官方文档:https://spring-cloud-alibaba-group.github.io/github-pages/hoxton/en-us/index.html
Spring Cloud Alibaba 为分布式应用开发提供一站式解决方案。它包含开发分布式应用程序所需的所有组件,使您可以轻松地使用 Spring Cloud 开发应用程序。

使用Spring Cloud Alibaba,您只需添加一些注解和少量配置,即可将Spring Cloud应用连接到阿里巴巴的分布式解决方案,并通过阿里巴巴中间件构建分布式应用系统。

1.2 spring cloud alibaba 特性

  • 流量控制和服务降级:使用 Alibaba Sentinel进行流量控制、断路和系统自适应保护。
  • 服务注册域与发现:实例可以注册到阿里巴巴Nacos,客户端可以使用Spring管理的bean来发现实例。通过Spring Cloud Netflix支持Ribbon,客户端负载均衡器。
  • 分布式配置:使用阿里巴巴Nacos作为数据存储。
  • 事件驱动:构建与Spring Cloud Stream RocketMQ Binder连接的高度可扩展的事件驱动微服务。
  • 消息总线:使用Spring Cloud Bus RocketMQ链接分布式系统的节点。
  • 分布式事务:用Seata支持高性能、易用的分布式事务解决方案
  • Dubbo RPC:通过Apache Dubbo RPC扩展Spring Cloud服务到服务调用的通信协议。

sentinel 替换hystrix
nacos替换eureka consul
nacos替换config&bus
分布式事务seta

1.3 Spring Cloud组件

服务注册与发现:eurekal;consul;nacos
服务间通信组件: restTemplate+ribbon;openfeign
服务降级和熔断:hystrix;hystrix dashboard;sentinel
服务网关组件:gateway
统一配置中心组件 消息总线组件:config; bus; nacos

2、SpringCloud Alibaba环境搭建

2.1 构建项目并引入依赖

springcloud版本:Hoxton.SR6
springboot版本:2.2.5.RELEASE
spring cloud alibaba版本:2.2.1.RELEASE

 <!--继承springboot父项目-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.5.RELEASE</version>
    </parent>
    <!--定义版本号-->
    <properties>
        <spring.cloud.version>Hoxton.SR6</spring.cloud.version>
        <spring.cloud.alibaba.version>2.2.1.RELEASE</spring.cloud.alibaba.version>
    </properties>

    <!--维护依赖-->
    <dependencyManagement>
        <dependencies>
             <!--维护springcloud-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring.cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--维护springcloud alibaba-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring.cloud.alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

在这里插入图片描述
在这里插入图片描述

posted @   别团等shy哥发育  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示