Error during Deserialization of PageImpl : Cannot construct instance of `org.springframework.data.domain.PageImpl`

Solution 1:

You can use wrapper of PageImpl and then:

public class PageImpl<T> extends org.springframework.data.domain.PageImpl<T> {

     @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
     public PageImpl(@JsonProperty("content") List<T> content,
                @JsonProperty("number") int page,
                @JsonProperty("size") int size,
                @JsonProperty("totalElements") long total) {

        super(content, PageRequest.of(page, size), total);
    }
}

Solution 2:

I fixed the issue for time being by using JAVA serializer but like to know how this can be fixed with JSON value serializer turned on

RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().disableCachingNullValues()
        .serializeValuesWith(
                RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.java()));