Spring Boot Best Practices

Chapter 1 · Practice 3 of 4

Upgrade to 4.x through the latest 3.5 and the properties migrator

From Versions, starters and dependencies

Why it matters

The migration guide's first step is to upgrade to the latest 3.5.x and remove every call to a deprecated API, because those were removed in 4.0. Jumping straight from an older 3.x usually means fixing two kinds of breakage at once.

A safe sequence:

  1. Move to the latest 3.5.x and fix all deprecation warnings.
  2. Check libraries Boot does not manage, such as Spring Cloud, for 4.x compatible versions.
  3. Upgrade to 4.x with the classic starters (spring-boot-starter-classic) so imports still resolve.
  4. Add spring-boot-properties-migrator: it reports renamed properties and translates them temporarily.
  5. Switch to the specific starters, then remove the classic starters and the migrator.

Watch for the big changes: Jackson 3 (packages move from com.fasterxml.jackson to tools.jackson), @MockBean removed in favour of @MockitoBean, and MongoDB properties moving from spring.data.mongodb to spring.mongodb.