Chapter 1. Migrating Spring Boot 2.5 applications to Spring Boot 2.7.18
The Spring Boot BOM (Bill of Materials) that manages dependencies for Red Hat-supported components is not available from Red Hat support for Spring Boot 2.7 onward. To migrate applications that use the Spring Boot BOM for dependency management, you can remove the BOM from your application’s pom.xml
file and then add the required dependencies with their versions in the pom.xml
file.
The following procedure shows you how to update some of the commonly used dependencies for Red Hat components. For a complete list of dependencies, see the Supported Spring Boot configurations and integrations.
Prerequisites
- You have a working Spring Boot application that uses the Spring Boot BOM.
Procedure
Remove the Spring Boot BOM from the
pom.xml
file in your application.If you use the BOM as a dependency in the
<dependencyManagement>
section ofthe pom.xml
file, remove the following lines from the file:<project> ... <dependencyManagement> <dependencies> <dependency> <groupId>io.dekorate</groupId> <artifactId>dekorate-spring-bom</artifactId> <version>${dekorate.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <dependency> <groupId>dev.snowdrop</groupId> <artifactId>snowdrop-dependencies</artifactId> <version>{version-spring-boot-bom}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
If you use the BOM as a parent BOM, remove the following lines from the file:
<project> ... <parent> <groupId>dev.snowdrop</groupId> <artifactId>snowdrop-dependencies</artifactId> <version>{version-spring-boot-bom}</version> </parent> ... </project>
Add management dependencies for Spring Boot and Dekorate. You can find the latest supported versions for the dependencies in Red Hat Runtimes: Component Details Overview.
<dependencyManagement> ... <dependency> <groupId>io.dekorate</groupId> <artifactId>dekorate-spring-bom</artifactId> <version>${dekorate.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> ... </dependencyManagement>
Add versions in the Red Hat-supported components included as dependencies. You can find the latest supported versions for the dependencies in Red Hat Runtimes: Component Details Overview.
<dependencies> ... <!-- Dekorate --> <dependency> <groupId>io.dekorate</groupId> <artifactId>openshift-spring-starter</artifactId> <version>${dekorate.version}</version> </dependency> <!-- Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> <exclusions> <exclusion> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jta_1.1_spec</artifactId> </exclusion> </exclusions> </dependency> <!-- Hibernate Validator--> <dependency> <groupId>org.hibernate.validator</groupId> <artifactId>hibernate-validator</artifactId> <version>${hibernate-validator.version}</version> </dependency> <!-- Narayana --> <dependency> <groupId>org.jboss.narayana.jta</groupId> <artifactId>narayana-jta</artifactId> <version>${narayana.version}</version> </dependency> <dependency> <groupId>org.jboss.narayana.jts</groupId> <artifactId>narayana-jts-integration</artifactId> <version>${narayana.version}</version> </dependency> <!-- RestEasy --> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-spring-boot-starter</artifactId> <version>${resteasy-spring-boot-starter.version}</version> </dependency> <!-- Tomcat --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-el</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat</groupId>org.apache.tomcat <artifactId>tomcat-jdbc</artifactId> <version>${tomcat.version}</version> </dependency> <!-- Undertow --> <dependency> <groupId>io.undertow</groupId> <artifactId>undertow-core</artifactId> <version>${undertow.version}</version> </dependency> ... </dependencies>
Remove the following
hibernate-core
exclusions from thespring-boot-starter-data-jpa
groupId, artifactId, version (GAV) if it is present:<exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </exclusion>
If you use the
org.springframework.boot:spring-boot-maven-plugin
, add the Spring Boot version to the plugin.<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot.version}</version> ... </plugin>
After you update the dependencies, you can build and launch your Spring Boot application. For more information, see Dekorate Guide for Spring Boot Developers.
Additional resources