springboot中@PostMapping常用说明
PostMapping属性
name
value 请求路由地址
path 指定路由地址
params 指定request中必须包含某些参数值
headers 指定request中必须包含某些指定的header值
consumes 请求提交内容类型,MediaType方式,如 application/json、application/x-www-urlencode、multipart/form-data等
produces 请求返回的数据类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回,如application/json
片段代码
@PostMapping(value = "/admin", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> postPCWithJson(@RequestBody Object body,HttpServletRequest request, HttpServletResponse response, HttpMethod httpMethod) throws URISyntaxException {
// TODO
return new ResponseEntity("", HttpStatus.OK);
}