Migrate code for Spring Boot 3.2.3 → 4.0.3 breaking changes
Spring Boot 4.0 introduces several breaking changes due to modularisation and the Jackson 3.x upgrade that require source-level fixes beyond the version bump.
Changes
-
Jackson 3.x (
tools.jackson): Spring Boot 4.0 ships Jackson 3.x under the newtools.jacksongroupId. The auto-configured bean is nowtools.jackson.databind.ObjectMapper, notcom.fasterxml.jackson.databind.ObjectMapper.- Removed explicit
com.fasterxml.jackson.core:jackson-databinddependency frompom.xml(managed by BOM) - Updated
GeminiServiceimports:com.fasterxml.jackson→tools.jackson
- Removed explicit
-
MockMvc test module split:
@AutoConfigureMockMvcmoved out ofspring-boot-test-autoconfigureinto the newspring-boot-webmvc-testmodule.- Added
spring-boot-starter-webmvc-testtest dependency topom.xml - Updated import in
TaxonomyApplicationTests:org.springframework.boot.test.autoconfigure.web.servlet→org.springframework.boot.webmvc.test.autoconfigure
- Added
// Before
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
// After
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.ObjectMapper;
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;