पाठ 24 / 25

Upgrading Spring Boot

Stay on supported versions.

Release notes, migration guides, OpenRewrite

Spring Boot releases frequently and supports each version for a limited time, so plan regular upgrades. Read the release notes and migration guide for each step (Spring Boot 4 brought modular starters such as spring-boot-starter-webmvc, new test-module packages for slice annotations, and a Java 17 baseline). Upgrade one minor version at a time, run the full test suite, and consider automated refactoring with OpenRewrite recipes. Keep dependencies managed by Boot's BOM.

Boot 4 changes seen in this course

Observed while building the demo; check the official migration guide for the full list.

web starter          spring-boot-starter-webmvc (servlet stack)
test starters        per technology, e.g. spring-boot-starter-webmvc-test
@WebMvcTest package  org.springframework.boot.webmvc.test.autoconfigure
@DataJpaTest package org.springframework.boot.data.jpa.test.autoconfigure
mocking              @MockitoBean (org.springframework.test.context.bean.override.mockito)
baseline             Java 17+ (this course used Java 21)

Upgrade often in small steps

Small, regular upgrades are far cheaper than jumping several major versions at once.

त्वरित जाँच: What is a safe way to upgrade Spring Boot?

  • Override every managed dependency version
  • Skip several major versions without testing
  • One version at a time, following the migration guide and running all tests
  • Never upgrade
Answer

One version at a time, following the migration guide and running all tests — Incremental, tested upgrades.