Open spring-projects-issues opened 7 years ago
Oliver Drotbohm commented
That's weird, as we definitely have test cases for that. Would you mind attaching an example that shows the problem?
Dimitri KOPRIWA commented
I have updated the issue with a github containing the running example
Oliver Drotbohm commented
Thanks for that but having to run an app and executing manual steps to get to something at somepoint is not something we usually investigate. Ideally, I get a sample that doesn't include any unrelated parts (React, Node etc.) and I can run mvn clean test
to see a test fail
Oliver Drotbohm commented
Couple of remarks:
@RepositoryRestController
is intended to be used to override Spring Data REST managed resources for properties (as it makes sure the URI refers to a repository in the first place). It's an annotation that's actually only used internally. It has to be public but it's not user facing API actually.@BasePathAwareController
is the annotation you want to use to blend controllers into Spring Data REST as they're forwarded unconditionally.I guess we need to do a better job of documenting how to use these annotations
Guram Savinov commented
Documentation says clearly that you sohuld use @RepositoryRestController
to (quote) "plug-in a custom handler for a Spring Data finder method".
Moreover, there is a note:
In this example, the combined path will be RepositoryRestConfiguration.getBasePath() + /scanners/search/listProducers.
In SDR 2.6.11.RELEASE it works: @RepositoryRestController
appends base path as it described.
One more concern:
To take advantage of Spring Data REST’s settings, message converters, exception handling, and more, use the
@RepositoryRestController
annotation instead of a standard Spring MVC@Controller
or@RestController
Does your suggestion to use @BasePathAwareController
instead of @RepositoryRestController means that we loose features mentioned above (like message converters, exception handling etc.)?
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Dimitri KOPRIWA opened DATAREST-991 and commented
It appear the repository rest controller annotation isn't working in spring-data.
Expected
to return a resource under basePath /api/greg
Result
404 Page not found
Step to reproduce
Clone project
Install deps
Create the file ManagerController.java under src/main/java/
Run
Open your browser and hit http://localhost:8080/api/greg
Version
Spring-boot 1.4.2.RELEASE
Demo
The project is a clone of the security directory of this repository https://github.com/spring-guides/tut-react-and-spring-data-rest
The only file I've created is ManagerController.java https://github.com/kopax/DATAREST-991/blob/master/src/main/java/com/greglturnquist/payroll/ManagerController.java
Affects: 2.6 GA (Ingalls), 2.5.7 (Hopper SR7)
2 votes, 4 watchers