序言
在学习Sping Cloud之前应该先知道其与Spring Boot的对应版本,不然会出现各种不兼容的情况,和一些未知的问题。
怎么查看版本呢?
访问网站
https://start.spring.io/actuator/info
然后呢找到 spring-cloud
这个节点
{
"Finchley.M2": "Spring Boot >=2.0.0.M3 and <2.0.0.M5",
"Finchley.M3": "Spring Boot >=2.0.0.M5 and <=2.0.0.M5",
"Finchley.M4": "Spring Boot >=2.0.0.M6 and <=2.0.0.M6",
"Finchley.M5": "Spring Boot >=2.0.0.M7 and <=2.0.0.M7",
"Finchley.M6": "Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1",
"Finchley.M7": "Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2",
"Finchley.M9": "Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE",
"Finchley.RC1": "Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE",
"Finchley.RC2": "Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE",
"Finchley.SR4": "Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT",
"Finchley.BUILD-SNAPSHOT": "Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3",
"Greenwich.M1": "Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE",
"Greenwich.SR3": "Spring Boot >=2.1.0.RELEASE and <2.1.10.BUILD-SNAPSHOT",
"Greenwich.BUILD-SNAPSHOT": "Spring Boot >=2.1.10.BUILD-SNAPSHOT and <2.2.0.M4",
"Hoxton.RC1": "Spring Boot >=2.2.0.M4 and <2.2.1.BUILD-SNAPSHOT",
"Hoxton.BUILD-SNAPSHOT": "Spring Boot >=2.2.1.BUILD-SNAPSHOT"
}
大概就是这个样子 比如Greenwich.SR3
这个版本 一般对应着 Spring Boot >=2.1.0.RELEASE and <2.1.10.BUILD-SNAPSHOT
也就是Spring Boot 版本大于2.1.0 小于2.1.10。
然后来官方提供了管理Spring Cloud 个个版本兼容的pom,就是下面这个
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
然后就可以像Spring Boot父工程那样管理自己内部的兼容版本号啦!
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>