spring-projects / spring-data-commons

Spring Data Commons. Interfaces and code shared between the various datastore specific implementations.

Home Page:https://spring.io/projects/spring-data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WarningMixing/WrappingMixing in PageModule overrides user defined Jackson annotations.

arvydzutis opened this issue · comments

Encountered while migrating Spring Boot from 3.2.7 to 3.3.1.
If custom class has extended PageImpl, the annotations, such as @JsonIgnoreProperties, does not work because of WarningMixing or WrappingMixing is now registered.

@JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"})
public class RestPage<T> extends PageImpl<T> {
...
}

The only way to fix this is to override the mixin:

objectMapper.addMixIn(PageImpl.class, RestPageMixin.class);
public interface RestPageMixin {
    @JsonIgnore
    Pageable getPageable();
}

Is it a bug or should we move to PagedModel?

It would be great if you could please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

sample.zip

  1. curl -v localhost:9191/
  2. Response includes "pageable"
  3. Change Spring Boot from 3.3.1 to 3.2.7.
  4. curl -v localhost:9191/
  5. Response does not include "pageable"

So @JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"}) is ignored in 3.3.1 because WarningMixing was introduced.