Difference between @RestController and @RepositoryRestController

后端 未结 1 1244
暖寄归人
暖寄归人 2020-12-15 19:44

What is the typical use case code that shows the difference between those two annotations - meaning the @RestController and the @Reposito

相关标签:
1条回答
  • 2020-12-15 20:05

    According to the annotation the RepositoryRestController is a way to provide custom controllers that still take advantage of spring data rest functionality

    http://docs.spring.io/spring-data/rest/docs/current/reference/html/#customizing-sdr.overriding-sdr-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.

    0 讨论(0)
提交回复
热议问题