1 @RestController
作用:标明此 Controller 提供 RestAPI
2 @RequestMapping
作用:映射 http 请求 URL 到java 方法
常用参数:
value:请求的url
method:请求方式,GET、POST、PUT、DELETE等
consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html
produces: 指定返回的内容类型,仅当request请求头中的类型中包含该指定类型才返回
params:指定request中必须包含某些参数值时,才让该方法处理
headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求
2.1 @GetMappring
此注解是 @RequestMapping 的变体,相当于 @RequestMapping(method=RequestMethod.GET)
2.2 @PostMapping
相当于 @RequestMapping(method=RequestMethod.POST)
2.3 @DeleteMapping
相当于 @RequestMapping(method=RequestMethod.DELETE)
2.4 @PutMapping
相当于 @RequestMapping(method=RequestMeth