背景:spring是支持rest风格的请求的。
spring在处理请求的时候,可以通过参数指定处那种类型的其请求。
比如:@RequestMapping(value="/user/login",method=RequestMethod.POST)
代表处理post请求。
spring为了简单,于是有了
@PostMapping ,接受post请求
@RequestMapping(method = RequestMethod.POST)
public @interface PostMapping {
@GetMapping
@RequestMapping(method = RequestMethod.GET)
public @interface GetMapping {
@PutMapping
@RequestMapping(method = RequestMethod.PUT)
public @interface PutMapping {
@DeleteMapping
@RequestMapping(method = RequestMethod.DELETE)
public @interface DeleteMapping {