關於Springboot、SpringCloud以及SpringCloud-Alibaba Nacos依賴問題


由於目前阿里的SpringCloud組件以及孵化成功,導致寫項目導入pom依賴座標時比較糾結,網上對版本的兼容介紹也變得五花八門。

SpringBoot和SpringCloud大版本對應關係

Spring Boot Spring Cloud
1.2.x Angel版本
1.3.x Brixton版本
1.4.x stripes Camden版本
1.5.x Dalston版本、Edgware版本
2.0.x Finchley版本
2.1.x Greenwich.SR2

Alibaba組件版本關係

Spring Cloud Alibaba Version Sentinel Version Nacos Version RocketMQ Version Dubbo Version Seata Version
(畢業版本) 2.2.0.RELEASE 1.7.1 1.1.4 4.4.0 2.7.4.1 1.0.0
(畢業版本) 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

SpringBoot、Cloud、Alibaba 畢業版本依賴關係(推薦使用)

Spring Cloud Version Spring Cloud Alibaba Version Spring Boot Version
Spring Cloud Hoxton 2.2.0.RELEASE 2.2.X.RELEASE
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 Hoxton
    如果需要使用 Spring Cloud Hoxton 版本,請在 dependencyManagement 中添加如下內容
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.2.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>
```xml

- Spring Cloud Greenwich
如果需要使用 Spring Cloud Greenwich 版本,請在 dependencyManagement 中添加如下內容
```xml
<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>
  • Spring Cloud Finchley
    如果需要使用 Spring Cloud Finchley 版本,請在 dependencyManagement 中添加如下內容
<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>
  • Spring Cloud Edgware
    如果需要使用 Spring Cloud Edgware 版本,請在 dependencyManagement 中添加如下內容
<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>

Alibaba組件依賴座標示例

以Nacos爲例

		<dependency>
			<groupId>com.alibaba.cloud</groupId>
			<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
		<dependency>
			<groupId>com.alibaba.cloud</groupId>
			<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
		</dependency>

摘自 版本說明
更多孵化器版本對應可點擊鏈接去官網查看

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章