As seen in the last tutorial, Spring Boot 4 moves away from the monolithic spring-boot-autoconfigure jar. Instead, each feature — Jackson, web MVC, JPA, validation, and so on — now lives in its own auto-configuration module. This modular design means you only pull in what you actually use, keeping your application lean and its startup fast.
In this tutorial we build a plain Spring Boot 4 application. The only feature-specific dependency is spring-boot-starter-jackson. We will see how the Jackson auto-configuration module activates automatically, how the auto-configured JsonMapper is created, and how to customize it without losing the settings Spring Boot applies from application.properties.
It is registered through the standard META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports file inside the spring-boot-jackson module. When Spring Boot detects Jackson 3 on the classpath, this class creates a pre-configured JsonMapper bean. The mapper already honours any spring.jackson.* properties you set in application.properties or application.yml.
To add further settings without replacing the auto-configured mapper, you supply a JsonMapperBuilderCustomizer bean. Spring Boot applies your customizer to the builder after it has read the property-based settings, so both layers of customization are preserved.
Let's continue with our example:
package com.logicbig.example;
import java.time.LocalDateTime;
public class User {
private String firstName;
private String lastName;
private String nickname;
private LocalDateTime registrationDate;
.............
}
The configuration class declares a single JsonMapperBuilderCustomizer bean. This is the recommended Spring Boot 4 extension point for Jackson 3. It enables pretty-printing and enforces NON_NULL value inclusion. Because it customizes the builder rather than replacing the mapper, the settings from application.properties (such as write-dates-as-timestamps) remain intact.
package com.logicbig.example;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import tools.jackson.databind.json.JsonMapper;
@Component
public class JsonDemoRunner implements CommandLineRunner {
private final JsonMapper jsonMapper;
public JsonDemoRunner(JsonMapper jsonMapper) {
this.jsonMapper = jsonMapper;
}
@Override
public void run(String... args) throws Exception {
User user = new User("Jane", "Doe");
String json = jsonMapper.writeValueAsString(user);
System.out.println("Serialized JSON:");
System.out.println(json);
User parsed = jsonMapper.readValue(json, User.class);
System.out.println("Deserialized user:");
System.out.println(parsed);
}
}
The runner injects the auto-configured JsonMapper and performs two operations: it serializes a User instance to JSON, then deserializes that JSON back into a User object. Both operations use the fully configured mapper — the properties file and the customizer have already been applied.
The nickname field is left null so that the NON_NULL inclusion setting can be observed.
2026-11-08T23:32:37.937-06:00 INFO 27796 --- [ main] c.l.example.AutoConfigDemoApplication : Starting AutoConfigDemoApplication using Java 17.0.4.1 with PID 27796 (D:\LogicBig\example-projects\spring-boot\spring-boot-4-auto-config-example\target\classes started by joe2 in D:\LogicBig\example-projects\spring-boot\spring-boot-4-auto-config-example) 2026-11-08T23:32:37.940-06:00 INFO 27796 --- [ main] c.l.example.AutoConfigDemoApplication : No active profile set, falling back to 1 default profile: "default" 2026-11-08T23:32:38.480-06:00 INFO 27796 --- [ main] c.l.example.AutoConfigDemoApplication : Started AutoConfigDemoApplication in 1.009 seconds (process running for 1.358) Serialized JSON: { "firstName" : "Jane", "lastName" : "Doe", "registrationDate" : [ 2026, 11, 8, 23, 32, 38, 485255100 ] } Deserialized user: User{firstName='Jane', lastName='Doe', nickname='null', registrationDate=2026-11-08T23:32:38.485255100}
Conclusion
This tutorial demonstrated Spring Boot 4's modular auto-configuration using spring-boot-starter-jackson in a non-web application. The Jackson auto-configuration module (spring-boot-jackson) was activated purely by the presence of the starter, and it produced a fully configured JsonMapper bean. By supplying a JsonMapperBuilderCustomizer, we added pretty-printing and null omission without discarding the property-based settings from application.properties. The expected output — JSON without the nickname field and formatted across multiple lines — confirms that both the auto-configuration and the customizer participated in building the mapper, which is the essence of Spring Boot 4's modular approach.
Example Project
Dependencies and Technologies Used:
Spring Boot 4.1.2 Corresponding Spring Framework Version 7.0.10 Version Compatibility: 4.0.0 - 4.1.2Version List
×
Version compatibilities of spring-boot-starter-parent with this example:
Java 17 min
4.0.0
4.0.1
4.0.2
4.0.3
4.0.4
4.0.5
4.0.6
4.0.7
4.0.8
4.0.9
4.1.0
4.1.1
4.1.2
Versions in green have been tested.
spring-boot-starter-jackson (Starter for using Jackson)
JDK 25
Build Tool:
Spring Boot 4 - Modular Auto-configuration with Jackson