Spring / Spring Boot 4 Basics Interview Questions
What changed with Jackson in Spring Boot 4 and what are the migration considerations?
Spring Boot 4 migrates from Jackson 2 to Jackson 3 as the primary JSON library. This is one of the highest-risk breaking changes for teams upgrading, because several serialisation behaviours change silently -- no compiler error, no deprecation warning, just different JSON output.
| Change | Jackson 2 (Boot 3) | Jackson 3 (Boot 4) |
|---|---|---|
| Package namespace | com.fasterxml.jackson | tools.jackson |
| Group ID | com.fasterxml.jackson.core | tools.jackson |
| Date serialisation | Timestamps (epoch millis) by default | ISO-8601 strings by default (WRITE_DATES_AS_TIMESTAMPS=false) |
| Property ordering | Insertion order by default | Alphabetical by default (SORT_PROPERTIES_ALPHABETICALLY=true) |
| Null handling | Configurable | Default changed; review null serialisation tests |
// Jackson 3: package migration // Old (Jackson 2 / Spring Boot 3): import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.annotation.JsonProperty; // New (Jackson 3 / Spring Boot 4): import tools.jackson.databind.ObjectMapper; import tools.jackson.annotation.JsonProperty; // Date serialisation change: // Jackson 2 default: {"createdAt": 1732099200000} // Jackson 3 default: {"createdAt": "2025-11-20T10:00:00Z"} // If your API clients expect timestamps, configure explicitly: @Configuration public class JacksonConfig { @Bean public Jackson3BuilderCustomizer timestampCustomizer() { return builder -> builder .featuresToEnable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS); } } // Automated migration using OpenRewrite: // Run this recipe to handle package renames: // org.openrewrite.java.jackson.UpgradeJackson_2_3 // mvn rewrite:run -Drewrite.activeRecipes=org.openrewrite.java.jackson.UpgradeJackson_2_3 // Property ordering change: // Jackson 2: {"name":"Alice","id":"1","email":"a@b.com"} // Jackson 3: {"email":"a@b.com","id":"1","name":"Alice"} <- alphabetical! // Fix tests that compare exact JSON strings character by character
More Related questions...