Class JsonViewRequestBodyAdvice

  • All Implemented Interfaces:
    RequestBodyAdvice

    public class JsonViewRequestBodyAdvice
    extends RequestBodyAdviceAdapter
    A RequestBodyAdvice implementation that adds support for Jackson's @JsonView annotation declared on a Spring MVC @HttpEntity or @RequestBody method parameter.

    The deserialization view specified in the annotation will be passed in to the MappingJackson2HttpMessageConverter which will then use it to deserialize the request body with.

    Note that despite @JsonView allowing for more than one class to be specified, the use for a request body advice is only supported with exactly one class argument. Consider the use of a composite interface.

    Jackson 2.5 or later is required for parameter-level use of @JsonView.

    Since:
    4.2
    Author:
    Sebastien Deleuze
    See Also:
    JsonView, ObjectMapper.readerWithView(Class)