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
Document how to override Spring Data REST exposed resources using manual controller implementations [DATAREST-535] #910
Comments
Jason Young commented Can you mention whether we should use |
Jason Young commented Also, are you sure these are the things to do to integrate custom controllers? Using SDR 2.3, I have a |
Greg Turnquist commented
So far, my usage of the annotation was wrapped around a custom controller that fetched entities using the related Spring Data repository. I haven't tinkered with it returning something else |
Greg Turnquist commented Can you assemble a small project on github that depicts the problem you are seeing. We have test cases like https://github.com/spring-projects/spring-data-rest/blob/master/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java#L603-L612, which test https://github.com/spring-projects/spring-data-rest/blob/master/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java, a custom controller, and they work fine. A better reproduction of your exact issue may help figure out what is wrong |
Jason Young commented I'll see what I can do, and will keep you posted. Thanks! |
Jason Young commented I've made a small project that demonstrates what I'm seeing: https://github.com/thinkbigthings/DATAREST-535 The signature of the repository whose search url I'm overriding returns a List<String>. I'm not sure that's the issue, it seems like it would happen regardless of the repository. It's also possible that I just don't what |
Greg Turnquist commented I made some tweaks and submitted it for review at https://github.com/thinkbigthings/DATAREST-535/pull/1. You don't have to commit it, but can instead use the PR to review my comments and feedback. In my PR, there is never a "PersistentyEntity must not be null" when invoking the injected repository's listProducers() call |
Jason Young commented Greg, thanks for experimenting with this! Since your changes fixed the problem I experimented with it some more, and found another clue. When I make the recommended changes to use I removed Maybe in the context of this jira issue, mention not to use security annotations at the controller method level? |
Jason Young commented I just checked out the latest reference guide (http://docs.spring.io/spring-data/rest/docs/2.4.0.M1/reference/html/#customizing-sdr.overriding-sdr-response-handlers) and saw no mention that |
Greg Turnquist commented The original intent of this issue was to update the docs. Discovering this Spring Security integration issue is best handled with a separate ticket |
Oliver Drotbohm opened DATAREST-535 and commented
To override the resources automatically exported using manual controllers the controllers written have to consider certain aspects to make sure, they're not picked up by the standard Spring MVC handler mapping:
@BasePathAwareController
instead of@Controller
or@RestController
@RequestMapping
on the type levelIssue Links:
Referenced from: pull request #177, and commits 394319f, 2afa6a6, ba6d0f8, c97034f, 48d4c3a
Backported to: 2.3.1 (Fowler SR1), 2.1.6 (Dijkstra SR6)
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: