PageImpl JSON serialization with Spring Boot 2

During the migration of a Spring Boot application from 1.5.13 to 2.0.2, some of my Spring Rest Docs tests started failing. The reason being that some of my RestControllers return a org.springframework.data.domain.PageImpl object (from Spring Data Commons). With Spring Boot 1.5.13, this results in JSON like this: However, with Spring Boot 2.0.2 (which includes Spring…