These two pieces of code above (the PageSerializer
class and Spring's @Configuration
class)
are intended to be included in a Spring Boot application (tested on version 1.4.2).
The custom serializer takes care of serializing org.springframework.data.domain.Page
instances
returned by a @RestController
that uses @JsonView
.
It will fully serialize the Page
object, albeit not having a matching @JsonView
,
but will process all @JsonView
annotations in the objects contained in that Page
.
More on performance using JPA lazy fetching and JSON serializing with @JsonView
in this link.
https://github.com/mefernandez/spring-jpa-lazy-projections
That is for those who uses JPA models in response serialization.