注解加上 produces = {"text/plain;charset=UTF-8"}
例如
@RequestMapping(value = "doDeal", method = RequestMethod.POST, produces = {"text/plain;charset=UTF-8"})
如果想返回json
改成 produces = {"application/json;charset=UTF-8"}即可.
本文介绍如何在Spring MVC中使用@RequestMapping注解来指定响应的内容类型,如text/plain或application/json,这对于控制API的输出格式至关重要。
注解加上 produces = {"text/plain;charset=UTF-8"}
例如
@RequestMapping(value = "doDeal", method = RequestMethod.POST, produces = {"text/plain;charset=UTF-8"})
如果想返回json
改成 produces = {"application/json;charset=UTF-8"}即可.
1451

被折叠的 条评论
为什么被折叠?