What is the typical use case code that shows the difference between those two annotations - meaning the @RestController and the @RepositoryRestController - ?
Asked
Active
Viewed 1.7k times
23
mCs
- 2,591
- 6
- 39
- 66
1 Answers
26
According to the annotation the RepositoryRestController is a way to provide custom controllers that still take advantage of Spring Data REST functionality.
Spring Data REST Reference Guide, 15.6. Overriding Spring Data REST Response Handlers:
Sometimes you may want to write a custom handler for a specific resource. 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.
Most importantly the RepositoryRestController is aware of the Spring Data REST base path and will be served under this base path.
hc_dev
- 8,389
- 1
- 26
- 38
Mathias Dpunkt
- 11,594
- 4
- 45
- 70