目录
RequestMapping#produces,consumes
@RequestMapping(value = "/hi",
consumes = "application/*;charset=UTF-8",
produces = "application/json;charset=UTF-8")
public String hi(@RequestParam(required = false) String msg) {
return "Hello -~" + msg;
}
-
produces(输出)
- 标注后影响最终传输的ContentType的类型
-
consumes(输入)
- 过滤请求头ContentType,限定允许的ContentType的类型
若编码不同则返回415