zl程序教程

您现在的位置是:首页 >  后端

当前栏目

【零开始搭建SpringCloud Alibaba】搭建SpringCloudAlibaba统一父依赖

SpringCloudspringcloudAlibaba依赖 搭建 开始 统一 Alibaba
2023-06-13 09:14:31 时间

搭建SpringCloud Alibaba

搭建统一父pom

版本兼容

我们需要关注的紧紧是版本兼容问题

SpringCloud和SpringBoot的版本兼容https://spring.io/projects/spring-cloud

SpringCloudAlibaba和SpringBoot的版本兼容https://github.com/alibaba/spring-cloud-alibaba/blob/master/README-zh.md

SpringCloudAlibaba官方整理的版本说明

https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E

Spring Cloud Version

Spring Cloud Alibaba Version

Spring Boot Version

Spring Cloud Hoxton.SR8

2.2.3.RELEASE

2.3.2.RELEASE

Spring Cloud Greenwich.SR6

2.1.3.RELEASE

2.1.13.RELEASE

Spring Cloud Hoxton.SR8

2.2.2.RELEASE

2.3.2.RELEASE

Spring Cloud Hoxton.SR3

2.2.1.RELEASE

2.2.5.RELEASE

Spring Cloud Hoxton.RELEASE

2.2.0.RELEASE

2.2.X.RELEASE

Spring Cloud Greenwich

2.1.2.RELEASE

2.1.X.RELEASE

Spring Cloud Finchley

2.0.3.RELEASE

2.0.X.RELEASE

Spring Cloud Edgware

1.5.1.RELEASE(停止维护,建议升级)

1.5.X.RELEASE

快速上手

首先它是在传统搭建SpringCloud的基础上,再引入SpringCloudAlibaba即可。

新建一个maven标准项目,在pom.xml文件配置以下标签属性即可

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>dy.springcloudalibaba</groupId>
    <artifactId>dy-springcloud-alibaba-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>SpringCloud-Alibaba公共父依赖</description>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
        <spring-cloud-alibaba-version>2.0.3.RELEASE</spring-cloud-alibaba-version>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <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>

</project>