You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Controllers annotated with @RepositoryRestController are served from the API base path defined in RepositoryRestConfiguration.setBasePath, which is used by all other RESTful endpoints (for example, /api).
I converted a system to SDR and didn't take notice of this part of documentation, so my properties don't include spring.data.rest.base-path=/api, but it still includes the old line server.servlet.contextPath=/api and that seems to be honored by SDR. I only have a @RepositoryRestController annotation on my controllers and they do override SDR's methods under /api.
But using, for example @RequestMapping("/users") in my UserController class seems to break SDR's endpoints for this entity in this setup, so I had to repeat @RequestMapping("/users") with this endpoint's base URI in every method. Not ideal. I'll want to fix my controllers when we reach a conclusion on this issue
…stMapping.
When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC.
Fixes#1342, #1628, #1686, #1946.
…stMapping.
When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC.
Fixes#1342, #1628, #1686, #1946.
…stMapping.
When we detected @BasePathAwareController and @RepositoryRestController instances, we now reject types that use @RequestMapping on the class level as doing so causes an inevitable registration of the controller with Spring MVC.
Fixes#1342, #1628, #1686, #1946.
Doogiemuc opened DATAREST-1327 and commented
The spring-data-rest doc sais:
https://docs.spring.io/spring-data/rest/docs/current/reference/html/#customizing-sdr.overriding-sdr-response-handlers
This is not true.
is not mapped at all.
One MUST use a
@RequestMapping
on class level. Even@RequestMapping
("/") works to map MyCustomController. See also https://stackoverflow.com/questions/38607421/spring-data-rest-controllers-behaviour-and-usage-of-basepathawarecontrollerThere is a workaround:
At least update the documentation to describe this correctly
Reference URL: https://stackoverflow.com/questions/38607421/spring-data-rest-controllers-behaviour-and-usage-of-basepathawarecontroller
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: