@ResponseBody 注解的作用
时间: 2023-09-27 10:07:43 浏览: 90
回答: @ResponseBody注解的作用是将Controller的方法返回的对象通过适当的转换器转换为指定的格式,然后写入到response对象的body区(响应体中)。通常用来返回JSON数据或者XML。该注解通常与@RequestMapping一起使用,用于标识该方法的返回结果直接写入HTTP response body中,而不是解析为跳转路径。当使用@ResponseBody注解后,方法的返回结果会直接返回给前端,比如异步获取JSON数据。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [@ResponseBody详解](https://blog.csdn.net/originations/article/details/89492884)[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]
- *3* [@ResponseBody注解的作用](https://blog.csdn.net/qq_41378597/article/details/84295071)[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]
[ .reference_list ]
阅读全文