@RestController干什么用的
时间: 2023-10-19 17:01:30 浏览: 61
@RestController注解在Spring中的作用等同于@Controller和@ResponseBody注解的组合使用。@Controller标识的类代表控制器类,控制层里的每个方法可以调用@Service标识的类(业务逻辑层)。而@ResponseBody注解则表示方法的返回值直接作为响应体返回给客户端。因此,@RestController注解用于标识一个类是控制器类,并且其中的方法的返回值将直接作为响应体返回给客户端。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [@RestController](https://blog.csdn.net/weixin_45807381/article/details/106850452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [@RestController注解作用](https://blog.csdn.net/sadjoker2048/article/details/125818750)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文