Upgrading from Spring Boot 2.5 to 2.7
In this course, you'll learn the benefits of upgrading from Spring Boot 2.5 to Spring Boot 2.7 and master our systematic and pragmatic approach to the upgrade process. Not only that, you'll use our hands-on lab environment to perform a real Spring Boot 2.5 to 2.7 upgrade for each step.
What is covered in this course?
- Upgrading an application from Spring Boot 2.5.x to 2.7.x
- Common pitfalls and gotchas (known knowns)
Note: Upgrading to Spring Boot 3.x will be the focus of another course in this Learning Path.
Why should I upgrade my Spring Boot version?
- Spring Boot 2.5.x is End of Support (EOS)
- Spring Boot 2.7 is the first official release that supports JDK 17
- It is the logical step to take before attempting to upgrade to Spring Boot 3.x
- There are deprecations that need to be addressed before any subsequent upgrade can be accomplished (e.g.Spring Boot 3.x upgrade).
- There are updates to various dependent libraries and sub-project versions along with their transitive dependencies.
- It is good practice to keep your applications up to date to mitigate security risks (CVEs) and code smells.
Prerequisites
You should be familiar with the following before pursuing this Course:
- Experience developing applications with Java
- Familiarity with one or more of these Java versions (8, 11, or 17)
- A working knowledge of Maven
- A working knowledge of Git
- A working knowledge of Spring 5.x
- A working knowledge of Spring Boot 2.x
Introduction
What is the general approach you should take to a Spring Boot 2.5 to 2.7 upgrade?
Assess
Learn how to assess your Spring Boot 2.5 application so you start from a known good state.
Lab: Compile the Application
Let's get our sample application compiling so we can start the upgrade.
Update the base Spring Boot version
Upgrading the base Spring Boot version is the first change you'll make in any upgrade.
Lab: Update the base Spring Boot Version
Update the spring-boot-starter-parent version in pom.xml
Update Spring and Spring Boot dependencies
Keep your Spring and Spring Boot dependencies in sync.
Lab: Update the Spring/Spring Boot dependencies
Update and cleanup Spring Dependencies to ensure that explicit versioning is removed, allowing the Spring Dependencies BOM to ensure consistency and interoperability.
Update non-Spring dependencies
Update/clean-up your non-Spring dependencies.
Lab: Update the Non-Spring Dependencies
Update the non-Spring dependencies in our sample project.
Successful compilation
The final steps to get the application to successfully compile again.
Lab: Get the application to successfully compile again
Get the application to fully compile again.
Spring Security considerations
Spring Security is it's own special beast to wrangle!
Lab: Update Spring Security version
You'll tackle upgrading Spring Security as it's own dedicated effort.
Run local tests
Now that our application is upgraded to Spring Boot 2.7, it's time to get the tests passing.
Lab: Fixing tests and housekeeping
Getting the tests running after an upgrade to Spring Boot 2.7 can be a challenge, but now you have the skills and knowledge to get it done!
Migrating from JUnit 4 to JUnit 5 (Juniper)
Migrating from JUnit 4 to JUnit 5 is worth considering.
Deprecated Properties & Runtime Errors
Dealing with deprecated properties and tricky runtime errors.
Lab: Deprecated Properties & Runtime Errors
Let the Spring Boot Property Migrator show you the way to property-fix bliss.
Testing for Parity
Now that the upgraded application actually runs, it's time to validate that it runs correctly, and at least as performantly as it did before the upgrade.
Release - Ship It!
You're not done until your upgraded application is running well in Production.