问题描述
显示这两个注释之间区别的典型用例 code 是什么 - 即 @RestController
和 @RepositoryRestController
- ?
What is the typical use case code that shows the difference between those two annotations - meaning the @RestController
and the @RepositoryRestController
- ?
推荐答案
根据注释RepositoryRestController
是一种提供仍然利用 Spring Data REST 功能的自定义控制器的方法.
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 参考指南,15.6.覆盖 Spring Data REST 响应处理程序:
Spring Data REST Reference Guide, 15.6. Overriding Spring Data REST Response Handlers:
有时您可能想为特定的资源.要利用 Spring Data REST 的设置,消息转换器、异常处理等,使用@RepositoryRestController 注解而不是标准的 Spring MVC@Controller 或 @RestController.
最重要的是 RepositoryRestController
知道 Spring Data REST 基本路径并将在此基本路径下提供服务.
Most importantly the RepositoryRestController
is aware of the Spring Data REST base path and will be served under this base path.
这篇关于@RestController 和 @RepositoryRestController 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!