Spring Cloud Alibaba依赖和版本说明

Spring Cloud Alibaba官方简介

官网地址
Spring Cloud Alibaba 致力于提供微服务开发的一站式解决方案。此项目包含开发分布式应用微服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来开发分布式应用服务。

依托 Spring Cloud Alibaba,您只需要添加一些注解和少量配置,就可以将 Spring Cloud 应用接入阿里微服务解决方案,通过阿里中间件来迅速搭建分布式应用系统。

前言

Spring Cloud Alibaba是阿里巴巴公司开源的一个微服务解决方案,现官方github的start数已有11k。而Spring Cloud Alibaba整个项目都是基于 Spring Cloud而扩展的, Spring Cloud 项目则又是基于 Spring Boot 进行开发。并且三者都是使用 Maven 做项目管理工具。所以当我们使用Spring Cloud Alibaba的组件的时候,我们必须严格遵守Spring Cloud Alibaba,Spring Cloud和Spring Boot之间的版本对应关系,引入对应的依赖。

版本说明

Spring Cloud Alibaba组件版本关系

Spring Cloud Alibaba Version Sentinel Version Nacos Version RocketMQ Version Dubbo Version Seata Version
(毕业版本) 2.1.1.RELEASE or 2.0.1.RELEASE or 1.5.1.RELEASE 1.7.0 1.1.4 4.4.0 2.7.3 0.9.0
(毕业版本) 2.1.0.RELEASE or 2.0.0.RELEASE or 1.5.0.RELEASE 1.6.3 1.1.1 4.4.0 2.7.3 0.7.1
(孵化器版本) 0.9.0.RELEASE or 0.2.2.RELEASE or 0.1.2.RELEASE 1.5.2 1.0.0 4.4.0 2.7.1 0.4.2
(孵化器版本) 0.2.1.RELEASE or 0.1.1.RELEASE 1.4.0 0.6.2 4.3.1
(孵化器版本) 0.2.0.RELEASE or 0.1.0.RELEASE 1.3.0-GA 0.3.0

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


Spring Cloud Version Spring Cloud Alibaba Version Spring Boot Version
Spring Cloud Greenwich 2.1.1.RELEASE 2.1.X.RELEASE
Spring Cloud Finchley 2.0.1.RELEASE 2.0.X.RELEASE
Spring Cloud Edgware 1.5.1.RELEASE 1.5.X.RELEASE

依赖管理

Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。

RELEASE 版本

Spring Cloud Greenwich

如果需要使用 Spring Cloud Greenwich 版本,请在 pom下的dependencyManagement 中添加如下内容

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>	
		<version>2.1.X.RELEASE</version>
	</parent>
	
  <dependencyManagement>
	<dependencies>
	  	<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-dependencies</artifactId>
			<version>Greenwich.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
    		<groupId>com.alibaba.cloud</groupId>
    		<artifactId>spring-cloud-alibaba-dependencies</artifactId>
    		<version>2.1.1.RELEASE</version>
    		<type>pom</type>
    		<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>
Spring Cloud Finchley

如果需要使用 Spring Cloud Finchley 版本,请在 pom下面添加如下内容

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>	
		<version>2.0.X.RELEASE</version>
	</parent>
	
  <dependencyManagement>
	<dependencies>
	  <dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-dependencies</artifactId>
		<version>Finchley.RELEASE</version>
		<type>pom</type>
		<scope>import</scope>
		</dependency>
		<dependency>
    		<groupId>com.alibaba.cloud</groupId>
    		<artifactId>spring-cloud-alibaba-dependencies</artifactId>
    		<version>2.0.1.RELEASE</version>
    		<type>pom</type>
    		<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>
Spring Cloud Edgware

如果需要使用 Spring Cloud Edgware 版本,请在 pom下面添加如下内容

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>	
		<version>1.5.X.RELEASE</version>
	</parent>
	
  <dependencyManagement>
	<dependencies>
	  <dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-dependencies</artifactId>
		<version>Edgware.RELEASE</version>
		<type>pom</type>
		<scope>import</scope>
		</dependency>
		<dependency>
    		<groupId>com.alibaba.cloud</groupId>
    		<artifactId>spring-cloud-alibaba-dependencies</artifactId>
    		<version>1.5.1.RELEASE</version>
    		<type>pom</type>
    		<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

孵化器版本依赖关系(官方不推荐使用)


Spring Cloud Version Spring Cloud Alibaba Version Spring Boot Version
Spring Cloud Greenwich 0.9.0.RELEASE 2.1.X.RELEASE
Spring Cloud Finchley 0.2.X.RELEASE 2.0.X.RELEASE
Spring Cloud Edgware 0.1.X.RELEASE 1.5.X.RELEASE

Note
请注意, Spring Cloud Edgware 最低支持 Edgware.SR5 版本

依赖管理

Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。

RELEASE 版本

需要使用Spring Cloud Alibaba相关依赖可以参考毕业版本

Sentinel


Sentinel分布式系统的流量防卫兵 Sentinel官网
随着微服务的流行,服务和服务之间的稳定性变得越来越重要。Sentinel 以流量为切入点,从流量控制、熔断降级、系统负载保护等多个维度保护服务的稳定性。

Alibaba Cloud 使用 Sentinel依赖

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

Sentinel Demo

Spring Cloud Zuul 支持

若想跟 Sentinel 配合使用,需要加上些依赖来让 spring-cloud-alibaba-sentinel-gateway 模块里的 Zuul 自动化配置类生效:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>

同时请将 spring.cloud.sentinel.filter.enabled 配置项置为 false(若在网关流控控制台上看到了 URL 资源,就是此配置项没有置为 false)。

Spring Cloud Gateway 支持

若想跟 Sentinel 配合使用,需要加上某些依赖来让 spring-cloud-alibaba-sentinel-gateway 模块里的 Spring Cloud Gateway 自动化配置类生效:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>

同时请将 spring.cloud.sentinel.filter.enabled 配置项置为 false(若在网关流控控制台上看到了 URL 资源,就是此配置项没有置为 false)。

Nacos


Nacos 官网
Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理。

Alibaba Cloud 使用 Nacos配置管理依赖

<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>

Alibaba Cloud 使用 Nacos发现服务依赖

<dependency>
	<groupId>com.alibaba.cloud</groupId>
	<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

Alibaba Cloud Dubbo


Dubbo 官网
Apache Dubbo™ 是一款高性能 Java RPC 框架。

Alibaba Cloud 使用 Dubbo服务依赖

	<dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-dubbo</artifactId>
    </dependency>

RocketMQ组件


RocketMQ 官网
RocketMQ 是一款开源的分布式消息系统,基于高可用分布式集群技术,提供低延时的、高可靠的消息发布与订阅服务。

Alibaba Cloud 使用 RocketMQ组件依赖

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
</dependency>

Seata(待完善)


阿里巴巴开源产品,一个易于使用的高性能微服务分布式事务解决方案。

Alibaba Cloud OSS


OSS 官网
阿里云对象存储服务(Object Storage Service,简称 OSS),是阿里云提供的海量、安全、低成本、高可靠的云存储服务。您可以在任何应用、任何时间、任何地点存储和访问任意类型的数据。
如果您的应用是 Spring Cloud 应用,且需要使用阿里云的 OSS 服务进行云端的文件存储,例如电商业务中常见的商品图片存储,那么您可以使用 OSS starter 完成 Spring Cloud 应用的对象存储。

Alibaba Cloud 使用 OSS服务依赖

 <dependency>
     <groupId>com.alibaba.cloud</groupId>
     <artifactId>spring-cloud-starter-alicloud-oss</artifactId>
 </dependency>

ANS(待完善)


Alibaba Cloud ACM(待完善)


一款在分布式架构环境中对应用配置进行集中管理和推送的应用配置中心产品。

Alibaba Cloud SchedulerX(待完善)


阿里中间件团队开发的一款分布式任务调度产品,提供秒级、精准、高可靠、高可用的定时(基于 Cron 表达式)任务调度服务。

Alibaba Cloud SMS(待完善)


覆盖全球的短信服务,友好、高效、智能的互联化通讯能力,帮助企业迅速搭建客户触达通道。

发布了29 篇原创文章 · 获赞 0 · 访问量 385

猜你喜欢

转载自blog.csdn.net/qq_43399077/article/details/103729902