4

I have seen examples (and they work with other objects, like String)

How to get list<String> as response from jersey2 client

So, I have a method that response to my endpoint like this:

 return Response.ok(new CustomDto<>(param1, param2)).build();

You can notice the <>

so the class lookes like this:

public class CustomDto<T extends OtherDto> extends PaginatorDto<T> {
...
}

So for my test I did this...

CustomDto resultPaginator = response.readEntity(CustomDto.class);

So I get this error

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `CustomDto` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

The class has no basic constructor (and I cannot add one)

Any idea how to get the results using this class?

Thanks

Dzmitry Bahdanovich
  • 1,375
  • 2
  • 12
  • 29
jpganz18
  • 4,518
  • 12
  • 48
  • 103

0 Answers0