Spring-5 ResponseEntity (no Creators, like default construct, exist)

1.6k views Asked by At

I am using Java 11 with spring-boot 2.1.3 version. I am consuming a 3rd party service in my code.

3rd party service is returning the org.springframework.http.ResponseEntity ( of org.springframework:spring-web:5.1.5.RELEASE).

Now I am getting issue while automatically unmarshling the 3rd party response as the ResponseEntity not having any default constructor.

Pseudocode of 3rd party Service signature:

 @POST
    public ResponseEntity<Abc> PostABC(){
// Some logic 
 return responseEntity;
}

Pseudocode At consumer side:

ResponseEntity<Abc> response = client.PostABC();

Error:

javax.ws.rs.client.ResponseProcessingException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.http.ResponseEntity` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

Why ResponseEntity is not having the Default Constructor? How can I fix this isue?

NOTE: I am getting LinkedHashMap as JSON is not able to translate to ResponseEntity

0

There are 0 answers