feign client page object error
See original GitHub issue@FeignClient("notice-service-provider")
public interface NoticeService {
@RequestMapping(value = NoticeConstants.NOTICES_PATH, method = RequestMethod.GET)
ResponseEntity<Page<NoticeEntity>> findAll();
}
if service return Page,get error:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.springframework.data.domain.Page, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
at [Source: java.io.PushbackInputStream@67635da8; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:892) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:139) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2810) ~[jackson-databind-2.6.4.jar:2.6.4]
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:221) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 30 common frames omitted
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Jackson with Feign can't deserialized Spring's org ...
The problem: A feign client, making an API call to a Spring boot Rest API that returns a Page<T> can't deserialize the sort...
Read more >Feign Client Exception Handling - Baeldung
We'll demonstrate how to handle exceptions in Feign in a Spring ... When an error occurs, the Feign client suppresses the original message....
Read more >Feign Error Handling with ErrorDecoder - Apps Developer Blog
In this tutorial, I will share with you how you can use Feign ErrorDecoder to handle errors that occur when using Feign client...
Read more >Spring Cloud OpenFeign
Feign is a declarative web service client. It makes writing web service clients easier. To use Feign create an interface and annotate it....
Read more >Decoder - OpenFeign/feign - Gitter
return HystrixFeign.builder() .client(defaultClient) .target(PongClient.class, ... Pageable object properties are bound with GET page=<page_num>, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi all, thanks for the feign integration - it’s really neat!
We worked around this issue by:
SpringMvcContract
in the client config to deserializePage
as Spring’sPageImpl
PageImpl
It would be a bit simpler to use your own
Page
implementation, but we wanted to use Spring’s dammit!Code is in kotlin, but you get the idea 😃
Customized contract
Make
Page
->PageImpl
Jackson module
Could probably have also achieved this via a Deserializer…
@jamesbassett
It works, thanks!