Is there any way to put a field inside a document's model as interface? Example:
public class Foo {
private String id;
private Bar bar;
}
Where Bar
is an interface with multiple implementations. Inside Bar there is a method signature String getType()
which it tells me which implementation I can use in order to map the data from the DB.
I've tried different solutions (@ReadingConverter
/@WiritingConverter
, @JsonSerialize
/@JsonDeserialize
) with no results. Every time I get
Failed to instantiate [Bar]: Specified class is an interface
Any help? Thank you!