-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Boot 3.2.4 (Cloud 2023.0.1) Cannot deserialize "pageable": "INSTANCE" #1018
Comments
Hello @dienarvil, thanks for reporting the issue. Please provide a minimal, complete, verifiable example that reproduces the issue. |
localhost:8080/testok -> feign call to ok end point with Page page = new PageImpl<>(build, PageRequest.of(0,2), 2); |
I just stumbled upon the same symptom and dug in a bit. The reported error happens when deserializing the following json: {
"content": [
"foo"
],
"pageable": "INSTANCE", <== HERE
"totalPages": 1,
"totalElements": 1,
"last": true,
"size": 1,
"number": 0,
"sort": [],
"numberOfElements": 1,
"first": true,
"empty": false
} As @dienarvil noted, the json is generated by the following: Page<String> page = new PageImpl<>(List.of("foo")); // or usage of Pageable.unpaged()
String json = this.objectMapper.writeValueAsString(page);
// deserialize json will throw the exception When serializing a It is not the json format that Per spring-projects/spring-data-commons#3024, spring-data-commons v3.3 may produce a more stable json representation. @dienarvil |
Thanks for the advice, yeah, with "normal" pagination from a repository the problem will never arise. Thanks again!! |
Thanks for the analysis @ttddyy. Until this gets addressed better in Spring Data, we expect a proper |
Describe the bug
Rest Controller in server with Spring Boot 2.7.18:
If I consume that end point from application with Spring Boot 2.7.18 (Cloud 2021.0.5) Deserialization is correct.
If I consume that end point from application with Spring Boot 3.2.4 (Cloud 2023.0.1) Deserialization fails.
log trace:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of
org.springframework.cloud.openfeign.support.PageJacksonModule$SimplePageable
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('INSTANCE')If I create Page object with the constructor:
Page page = new PageImpl<>(build, PageRequest.of(0,2), 2);
Works perfectly in Spring 2.7.18 and Spring boot 3.2.4
Thank you !!
The text was updated successfully, but these errors were encountered: