Suppose I have some @RestController with a @PostMapping like this:
@PostMapping
public SomeResponse create(@RequestBody AbstractRequest request) {
...
}
and this AbstractRequest is an abstract class extended by ConcreteOneRequest and ConcreteTwoRequest classes:
@Value
@SuperBuilder
public ConcreteOneRequest extends AbstractRequest {
String concreteOneUniqueField;
}
@Value
@SuperBuilder
public ConcreteTwoRequest extends AbstractRequest {
String concreteTwoUniqueField;
}
Based on the above structure how can I use @JsonTypeInfo and/or @JsonSubTypes and/or @JsonTypeResolver to deserialize to the proper concrete class?
I have read the Jackson JavaDocs but I cannot understand their usage, I've also searched for specific examples but none I found matched my requirements.
Please help, thanks in advance.