Skip to content

Provide a way to set resource relations through annotations #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sdeleuze opened this issue Oct 18, 2015 · 1 comment
Open

Provide a way to set resource relations through annotations #401

sdeleuze opened this issue Oct 18, 2015 · 1 comment

Comments

@sdeleuze
Copy link

As raised on stack overflow, it could be very useful to provide a way to define resource relations just with annotated Pojo + regular Spring MVC controllers returning Pojo instances, without having to extend ResourceSupport or wrapping it into a Resource<Foo> container.

This is maybe already possible with the @Relation annotation, but I did not find any example or documentation about this.

If this is already possible, could you give me a quick example in order to allow me to contribute a documentation PR that will explain how to use the pure Pojo + @Relation approach?

If it is currently no possible, should it be possible to add such functionality as an alternative to Foo extends ResourceSupport and Resource<Foo> ones? Since annotations are static, I guess it will perhaps not cover all the use cases covered by the current Resource based approach, but that should be enough for a lot of use cases and I think that could awesome for our users to support this alternative way of dealing with relations.

Any thoughts?

@pperez
Copy link

pperez commented Sep 28, 2016

According to this http://docs.spring.io/spring-hateoas/docs/current/reference/html/#fundamentals.obtaining-links.builder.methods the default relprovider should handle the Relation annotation, but in my case it didn't worked :(
I had to register a custom relationrelprovider which implements this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants