@RequestMapping注解

属性:
produces: 必须和@RequestBody一起使用
可以设置返回数据的类型以及编码,可以是json或者xml

  1. @RequestMapping(value="/xxx",produces = {"application/json;charset=UTF-8"})
  2. @RequestMapping(value="/xxx",produces = {"application/xml;charset=UTF-8"})

文本类型

  1. @RequestMapping(value = "/xxx",produces = {"text/plain;charset=utf-8"})