Summary
In Spring Boot 4, MappingJacksonValue is deprecated in favor of serialization hints passed through SmartHttpMessageConverter. For reactive controllers, the recommended pattern is to attach dynamic serialization hints directly to the ServerHttpResponse or via BodyInserters, allowing you to choose a JsonView (or any Jackson 3 hint) at runtime without abandoning your hybrid controller architecture.
Root Cause
The deprecation stems from Spring Framework 7’s shift toward:
- Unified serialization hint APIs across blocking and reactive stacks
- Jackson 3’s immutable
JsonMapper, which encourages explicit, contextual serialization configuration rather than wrapper objects - Cleaner separation between controller logic and message conversion layers
Why This Happens in Real Systems
Real-world systems often need:
- Dynamic field filtering based on user roles, query parameters, or feature flags
- Reactive pipelines that must remain non-blocking while still applying conditional serialization
- Hybrid architectures mixing functional routing and annotated controllers, making method-level
@JsonViewinsufficient
These constraints expose the limitations of MappingJacksonValue, which was tightly coupled to the old message conversion pipeline.
Real-World Impact
When upgrading to Spring Boot 4 + Jackson 3:
- Existing dynamic
@JsonViewlogic breaks or becomes unsupported - Reactive endpoints cannot rely on legacy wrappers
- Teams must adopt serialization hints, which require a different mental model
- Misuse leads to incorrect JSON output, missing fields, or performance regressions
Example or Code (if necessary and relevant)
Below is a minimal example showing how to apply a dynamic JsonView using serialization hints in a reactive controller:
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonView;
import reactor.core.publisher.Mono;
@RestController
public class DemoController {
@GetMapping("/demo")
public Mono<ResponseEntity
This pattern uses the .hint() API introduced alongside Jackson 3 integration in Spring Boot 4, which is the officially recommended replacement for MappingJacksonValue.
How Senior Engineers Fix It
Experienced engineers typically:
- Adopt serialization hints as the new standard abstraction
- Centralize view-selection logic in a service or resolver to avoid scattering conditional logic
- Ensure converters support hints (e.g., Jackson2 converters do by default in Spring Boot 4)
- Test serialization paths explicitly, especially in reactive flows
- Avoid blocking ObjectMapper mutations, relying instead on Jackson 3’s immutable
JsonMapper
Why Juniors Miss It
Less experienced developers often:
- Assume
@JsonViewmust be applied at method level and don’t realize it can be passed as a hint - Try to retrofit
MappingJacksonValueinto reactive pipelines, not knowing it’s deprecated - Overlook the converter layer, focusing only on controller annotations
- Miss the subtle shift from ObjectMapper mutation to contextual serialization hints introduced by Jackson 3
This leads to confusion, brittle workarounds, and inconsistent JSON output.
If you want, I can also generate a more advanced example showing:
- Multiple dynamic hints
- Integration with functional routing
- Role-based view resolution