Spring4.3中引进了{@GetMapping、@PostMapping、@PutMapping、@DeleteMapping、@PatchMapping},来帮助简化常用的HTTP方法的映射,并更好地表达被注解方法的语义。
以@GetMapping为例,Spring官方文档说:
@GetMapping是一个组合注解,是@RequestMapping(method = RequestMethod.GET)的缩写。该注解将HTTP Get 映射到 特定的处理方法上。
Difference between @GetMapping & @RequestMapping:
@GetMapping does not support the consumes attribute of @RequestMapping.
Spring4.3引入了@GetMapping、@PostMapping等新注解以简化HTTP方法映射并增强语义表达。@GetMapping为@RequestMapping(method=RequestMethod.GET)的简写,用于将HTTP GET请求映射到特定处理方法。
759





