@RestController的含义
时间: 2023-10-04 09:10:55 浏览: 89
@RestController是一个Spring框架中的注解,它的含义是将一个类声明为控制器,并将其方法的返回值直接转换为JSON格式的响应。 这个注解的作用是简化开发人员编写RESTful风格的接口,并方便地返回JSON数据给客户端。 在使用@RestController注解的类中,无需在每个方法前面添加@ResponseBody注解,而且无法返回JSP或HTML页面,因为视图解析器无法解析这些类型的页面。 所以,@RestController注解可以让开发人员更方便地编写RESTful接口并返回JSON数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [@RestController当中的value 含义](https://blog.csdn.net/qq_43409111/article/details/123714042)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [SpringBoot http请求注解@RestController原理解析](https://download.csdn.net/download/weixin_38615591/12743692)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [@Service注解的作用以及@Controller和@RestController的区别](https://blog.csdn.net/weixin_44860226/article/details/129614968)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文