Spring Boot version and Spring Cloud versions
You cannot use any Spring Cloud version with any Spring Boot version.
Table 1. Release train Spring Boot compatibility
Release Train | Release Train |
---|---|
2022.0.x aka Kilburn | 3.0.x |
2021.0.x aka Jubilee | 2.6.x, 2.7.x (Starting with 2021.0.3) |
2020.0.x aka Ilford | 2.4.x, 2.5.x (Starting with 2020.0.3) |
Hoxton | 2.2.x, 2.3.x (Starting with SR5) |
Greenwich | 2.1.x |
Finchley | 2.0.x |
Edgware | 1.5.x |
Dalston | 1.5.x |
In the pom.xml, an efficient way to add both Spring Boot and Spring Cloud is declaring the spring-boot-starter-parent as the parent pom and and the spring-cloud-dependencies BOM as imported dependencies in the dependencies management tag.
So for example if I want to use the Horton version of Spring Cloud (to use the Spring client-side loadbalancer) my pom.xml has to be declared as :
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>davidhxxx</groupId> <artifactId>foo-artifact</artifactId> <version>0.0.1-SNAPSHOT</version> <name>foo-artifact</name> <properties> <spring-cloud.version>Hoxton.RELEASE</spring-cloud.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> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency> </dependencies> </project> |
The declared dependencies coming from the spring cloud dependencies don’t have to specify a version. We have to use the provided version in the BOM to ensure their compatibility.