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 theconsumesattribute of@RequestMapping.
上文翻译:
@GetMapping 和 @RequestMapping的不同之处在于@GetMapping不支持@RequestMapping的自定义属性。
总结:Spring4.3中引进了{@GetMapping、@PostMapping}简化书写,高效开发!
最后
以上就是奋斗月亮最近收集整理的关于SpringMVC之组合注解@GetMapping的全部内容,更多相关SpringMVC之组合注解@GetMapping内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复