Environment:
Spring-boot: 2.0.5.RELEASE
The problem:
Given:
@Transactional(readOnly = true)
@GetMapping(value = "/list")
public ResponseEntity<List<CarDTO>> getList(@RequestParam final InteriorDTO interior) {
return ResponseEntity.ok(getCarsBy(interior));
}
DTO
public class InteriorDTO extends DetailsDTO {
}
public class DetailsDTO {
private int listSize;
}
When:
GET /cars/list?interior=eyJsaXN0U2l6ZSI6NX0=
(eyJsaXN0U2l6ZSI6NX0=
is base64 encoded: {"listSize":5}
)
Then:
Failed to convert value of type 'java.lang.String' to required type '(...).InteriorDTO'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type '(...).InteriorDTO': no matching editors or conversion strategy found
The question:
How to properly define deserializer for jackson to make him handle that case ? should it be something like this (doesn't work for me) ?