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.
- curl -v localhost:9191/
- Response includes "pageable"
- Change Spring Boot from 3.3.1 to 3.2.7.
- curl -v localhost:9191/
- Response does not include "pageable"
So @JsonIgnoreProperties(ignoreUnknown = true, value = {"pageable"}) is ignored in 3.3.1 because WarningMixing was introduced.