Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY)
@JsonSubTypes({ @JsonSubTypes.Type(value = AddEvent.class, name = "add"),
@JsonSubTypes.Type(value = UpdateEvent.class, name = "update") })
public interface BaseEvent { public int baseValue; }
public class AddEvent implements BaseEvent { private String addValue;}
public class UpdateEvent implements BaseEvent { private String updateValue;}
Describe your motivation
If you have
then you get
which is expected but then you have
you get
Describe the solution you'd like
The parameter type should not be
BaseEvent
but insteadBaseEventUnion
. The same for the return typeDescribe alternatives you've considered
No response
Additional context
No response