之前映射url到控制器类一直用的都是@RequestMapping,今天用到了@GetMapping,
@PostMapping这两种新的注解,简单总结一下。
一、处理请求方式
@GetMapping,处理get请求
@PostMapping,处理post请求
二、用法
@getMapping与@postMapping是组合注解,相当于简化了@RequestMapping。
@getMapping = @requestMapping(method = RequestMethod.GET)。
@postMapping = @requestMapping(method = RequestMethod.POST)。