Spring Cloud Alibaba学习笔记(1) - 整合Spring Cloud Alibaba

  Spring Cloud Alibaba从孵化器版本毕业:https://github.com/alibaba/spring-cloud-alibaba,记录一下本身学习Spring Cloud Alibaba的笔记。git

1.在整合Spring Cloud Alibaba以前,首先须要整合Spring Cloud

  在Spring Cloud的官网能够了解到目前最新的稳定版Spring Cloud版本,我所选择版本是Greenwich.SR3。在项目的pom.xml文件中加入如下代码段就能够整合Spring Cloud了。github

<dependencyManagement>
        <dependencies>
            <!-- 整合spring-cloud-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.SR3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

2.接下来整合Spring CLoud Alibaba

整合Spring CLoud Alibaba须要注意与Spring Cloud之间的版本对应,如下是官网给出的版本对应关系。spring

Spring Cloud Version Spring Cloud Alibaba Version Spring Boot Version

Spring Cloud Greenwich学习

2.1.0.RELEASEspa

2.1.X.RELEASEcode

Spring Cloud Finchleyxml

2.0.0.RELEASEblog

2.0.X.RELEASEci

Spring Cloud Edgwareget

1.5.0.RELEASE

1.5.X.RELEASE

 

 

 

 

 

 

 

对于我所使用的 Spring Cloud Greenwich.SR3版本,只须要在 dependencyManagement 中添加以下内容:

<!-- 整合spring-cloud-alibaba-->
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.1.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

若是你使用 Spring Cloud Finchley 版本,请在 dependencyManagement 中添加以下内容:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>2.0.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

若是你使用 Spring Cloud Edgware 版本,请在 dependencyManagement 中添加以下内容:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
    <version>1.5.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

整合完毕。