天天看點

Spring Cloud Alibaba與Spring Boot、Spring Cloud之間不得不說的版本關系

Spring Cloud Alibaba現階段版本的特殊性

現在的Spring Cloud Alibaba由于沒有納入到Spring Cloud的主版本管理中,是以我們需要自己去引入其版本資訊,比如之前教程中的例子:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Finchley.SR1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-alibaba-dependencies</artifactId>
            <version>0.2.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>      

由于Spring Cloud基于Spring Boot建構,而Spring Cloud Alibaba又基于Spring Cloud Common的規範實作,是以當我們使用Spring Cloud Alibaba來建構微服務應用的時候,需要知道這三者之間的版本關系。而不是像以往使用Spring Cloud的時候,直接引入Spring Cloud的主版本(Dalston、Edgware、Finchley、Greenwich這些)就可以的。我們需要像上面的例子那樣,單獨的引入

spring-cloud-alibaba-dependencies

來管理Spring Cloud Alibaba下的元件版本。

下表整理了目前Spring Cloud Alibaba的版本與Spring Boot、Spring Cloud版本的相容關系:

Spring Boot Spring Cloud Spring Cloud Alibaba
2.1.x Greenwich 0.9.x
2.0.x Finchley 0.2.x
1.5.x Edgware 0.1.x
Dalston

以上版本對應内容根據目前情況實時調整修改,以友善使用者了解他們的對應關系變化情況

是以,不論您是在讀我的《Spring Boot基礎教程》、《Spring Cloud基礎教程》還是正在連載的《Spring Cloud Alibaba系列教程》。當您照着博子的順序,一步步做下來,但是沒有調試成功的時候,強烈建議檢查一下,您使用的版本是否符合上表的關系。