Spring Boot is a very widely used open source Java framework for implementing stand-alone applications with the Spring framework. Thanks to the convention-based approach, applications can be set up quickly and efficiently without a great deal of configuration effort.
In addition to some innovations, version 3 also brings some breaking changes. The general migration path is detailed on the GitHub page. Below we go into more detail about the biggest obstacles in our project context.
Spring Boot 3
The most important changes include:
- Java 17
- JakartaEE instead of JavaEE
- Improved support for observability with Micrometer
- GraalVM native image support
- Adjustments to the autoconfiguration mechanism
Since we use Maven as a build system and are already using the latest version 2.7, the first step of the conversion was trivial. In our pom.xml we only had to adjust the spring boot version and the java version:
<properties>
<java.version>17</java.version>
<springboot.version>3.1.3</springboot.version>
</properties>
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${springboot.version}</version>
<relativePath />
</parent>
</parent>
This will also update all Spring-Boot dependencies at the same time.
javax becomes jakarta
// this
import javax.servlet.*;
// becomes:
import jakarta.servlet.*;
Looks easy? It took us the longest time in the entire migration.
Hundreds of classes had to be customized using Search and Replace. The IntelliJ Tool-Box could have done the work here, but the project context didn’t allow it. This was followed by some adjustments to build scripts for WSDL and XSD interfaces with XJC and wsconsume.
When all projects were free of compile errors, testing began. A part could be covered with unit and integration tests. So some runtime problems could be uncovered; mostly caused by OSGi plugin internal third-party libraries. Some things were also found and corrected in the test environment.
Transient problems
Spring Boot 3 also comes with a Hibernate update. Version 6.0 sets the Criteria API and hbm.xml mappings to deprecated. The console is full of obvious warnings:
WARN: HHH90000028: Support for <hibernate-mappings/> is deprecated [RESOURCE : resources/hibernate-configs/hibernate-mappings/event.hbm.xml]; migrate to orm.xml or mapping.xml, or enable hibernate.transform_hbm_xml.enabled for on the fly transformation
WARN: HHH90000028: Support for <hibernate-mappings/> is deprecated [RESOURCE : resources/hibernate-configs/hibernate-mappings/job.hbm.xml]; migrate to orm.xml or mapping.xml, or enable hibernate.transform_hbm_xml.enabled for on the fly transformation
...
These changes have been postponed for the time being due to time pressure. (Hibernate 6.0 Migration Guide)
Verdict
Admittedly, the project is by no means representative. Nevertheless, we underestimated the conversion effort.
Thank you Oracle. Not.