spring-hateoas
spring-hateoas copied to clipboard
Request: Support subclasses for @ExposesResourceFor
trafficstars
With Spring HATEOAS 1.5.6, I am writing a REST controller (/activity) that can return multiple subtypes of ActivityDto (ActivityMentionDto, ActivityReplyDto, etc.). I want to be able to annotate the controller with @ExposesResourceFor(ActivityDto.class) and use EntityLinks to generate self links for the concrete classes. However, this produces this error at runtime:
Cannot determine link for com.example/ActivityMentionDto! No EntityLinks instance found supporting the domain type!
As @ExposesResourceFor takes only a single Class parameter and is not repeatable, I would like @ExposesResourceFor to support subclasses of the declared type in the absence of a more specific declaration.