title: Spring dynamically select @JsonView with pagination
body: <p>I want to select the Json View applied to my data depending on an URL parameter. I am trying to implement this using <code>@JsonView</code> annotations, and I tried some solutions (<a href="https://stackoverflow.com/questions/28878488/dynamic-selection-of-jsonview-in-spring-mvc-controller/29103449#29103449">1</a>, <a href="https://stackoverflow.com/questions/28878488/dynamic-selection-of-jsonview-in-spring-mvc-controller">2</a>). The thing is that those solutions are basen on the controller action returning a <code>MappingJacksonValue</code>, but I cannot use that because I am using pagination.</p>
  
  <p>My action:</p>
  
  <pre><code>public ResponseEntity&lt;Page&lt;MyEntity&gt;&gt; findAll(
    int viewMode,
    Pageable pageable) {
      result = service.findAll(pageable);
  
    // Here I would like to apply a Json View to the result set depending 
    // on the variable viewMode
  
    return new ResponseEntity&lt;Page&lt;MyEntity&gt;&gt;(
      /* Resultset with the selected view applied, and paginated */, 
      HttpStatus.OK
    );
  }
  </code></pre>