美文网首页
@RequestMapping   和  @GetMapping

@RequestMapping   和  @GetMapping

作者: 桌面很乱 | 来源:发表于2019-10-02 04:17 被阅读0次

@RequestMapping 和 @GetMapping @PostMapping 区别

新的项目 在controller中 方法上面 没有RequestMapping 写的是 GetMapping 一时间不知道是什么意思 查了一下 发现是一个组合注解

Spring4.3中引进了{@GetMapping、@PostMapping、@PutMapping、@DeleteMapping、@PatchMapping} 来帮助简化常用的HTTP方法的映射 并更好地表达被注解方法的语义
该注解将HTTP Get 映射到 特定的处理方法上

@GetMapping是一个组合注解 是@RequestMapping(method = RequestMethod.GET)的缩写

@PostMapping是一个组合注解 是@RequestMapping(method = RequestMethod.POST)的缩写

————————————————
版权声明:本文为CSDN博主「国家一级键盘手操作表演艺术家」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ziany/article/details/80541311

相关文章

网友评论

      本文标题:@RequestMapping   和  @GetMapping

      本文链接:https://www.haomeiwen.com/subject/ojvcyctx.html