Spring
Follow
Introducing Jackson 3 support in Spring
Spring Framework is introducing support for Jackson 3, the latest version of the popular JVM JSON library, in Spring Boot 4 and related projects. This significant update follows the Jackson 3.0.0 GA release and builds upon past Jackson integration improvements. The Spring and Jackson teams collaborated closely during the Jackson 3 release candidate phase, leading to several refinements. These include allowing co-existence of Jackson 2 and 3, a JDK 17 baseline, aligned defaults for JSON views, and enhanced null-safety and non-blocking parser capabilities. Spring Boot 4 will provide dependency management for both Jackson versions but will auto-configure only for Jackson 3, making it the default. Migrating applications are encouraged to adopt Jackson 3, although temporary use of Jackson 2 is possible with some manual configuration. Key migration steps involve updating package names from `com.fasterxml.jackson` to `tools.jackson` and adapting to new default settings in Jackson 3, such as alphabetical property sorting and date serialization formats. The introduction of an immutable `JsonMapper` in Jackson 3 replaces the mutable `ObjectMapper` from Jackson 2, simplifying configuration with `JsonMapper.Builder`. The deprecated `MappingJackson2HttpMessageConverter` is replaced by a more capable `JacksonJsonHttpMessageConverter` that uses serialization hints directly, eliminating the need for wrappers like `MappingJacksonValue`. Spring Security 7.0 will also support Jackson 3, enhancing safety by disabling default global typing and introducing a `PolymorphicTypeValidator`. Spring Data 4.0 brings full Jackson 3 support across its modules, though some, like Spring Data REST and Spring HATEOAS, will require a full migration to Jackson 3.