【SpringMVC】@RequestMapping和@GetMapping的区别
【提问】
Spring的注解中,@RequestMapping和@GetMapping有什么区别?
【解答】
二者均用于限定该Controller方法只能使用get方式请求,@GetMapping作为@RequestMapping的派生注解,作用是简单直观。
具体区别:
1、目标范围不同
@RequestMapping 能注解在类(ElementType.Type)和方法(ElementType.Method)中
@GetMapping 只能注解方法(ElementType.Method)
2、功能不同
注解在方法时,@GetMapping 等价于 @RequestMapping(method= RequestMethod.GET)
【前置知识点】
@RequestMapping 详解
【SpringMVC】@RequestMapping和@GetMapping的区别相关推荐
- @RequestMapping 和 @GetMapping @PostMapping 区别
@RequestMapping 和 @GetMapping @PostMapping 区别 @GetMapping是一个组合注解,是@RequestMapping(method = Reques ...
- @RequestMapping 和 @GetMapping @PostMapping 区别
@RequestMapping 和 @GetMapping @PostMapping 区别 @GetMapping是一个组合注解,是@RequestMapping(method = Reques ...
- @RequestMapping和@GetMapping @PostMapping 区别
记录: 用法 等效于 @RequestMapping @GetMapping @RequestMapping(method = RequestMethod.GET) @PostMapping @R ...
- SpringMVC@RequestMapping请求方法限定与请求参数限定
SpringMVC@RequestMapping请求方法限定与请求参数限定 一.请求方法限定 除了可以对url进行设置,还可以限定请求进来的方法 限定GET方法 @RequestMapping(met ...
- 【学习笔记】SpringMVC—@RequestMapping注解
[学习笔记]SpringMVC-@RequestMapping注解
- 基本注解详解@RequestMapping,@GetMapping
基本注解详解@RequestMapping,@GetMapping 1. @RequestMapping注解 @RequestMapping注解是一个用来处理请求地址映射的注解,可用于映射一个请求或一 ...
- @RequestMapping 和 @GetMapping 、@PostMapping 的区别(详解)
HTTP请求方法 HTTP请求方法一共有9种,为 GET.POST.HEAD.OPTIONS.PUT.PATCH.DELETE.TRACE.CONNECT. GET [获取资源]本质就是发送一个请求来 ...
- @RequestMapping与@GetMapping区别
@GetMapping @GetMapping是@RequestMapping (method = RequestMethod.GET)缩写的组合注解 @GetMapping(value = &quo ...
- springmvc中url-url-pattern /和/*的区别
2019独角兽企业重金招聘Python工程师标准>>> 在使用springmvc时,都会在web.xml中配置一个dispatchservlet,如下: <listener&g ...
最新文章
- C# SortedDictionary以及SortedList的浅谈
- arduino红外热释电传感器_压力传感器在汽车空调系统中的应用
- Python使用PDFMiner解析PDF
- 东方明珠胡俊:「东方明珠数据中台」四年发展历史全解(内附彩蛋)
- Scala if...else案例
- Android面试总结经
- AutoIT: ControlCommand是一个非常重要的指令
- 电视机鸿蒙os卡,开卖40天,搭载鸿蒙OS操作系统的华为电视就差评如潮?用户:亏了...
- CSDN资源免费下载攻略,手慢无!
- PHP的.htaccess作用
- IsPostBack介绍
- office插件开发_推荐!办公必备,Office插件大合集
- mysql唯一索引和聚合索引区别_唯一索引、聚集索引和聚集索引
- 简单的html网页超链接
- python爬虫---12306获取列车座位信息
- invalid vcs root mapping 怎么解决_一加黑鲨华硕OPPO等手机root后微信指纹支付不可用怎么解决...
- snmpset对象不可写_写 I/O 路径 (FTT1/RF2) 对比 – Nutanix vs VMware vSAN
- 计算机主机报警是怎么回事,计算机不断报警的原因是什么?
- Shop项目--9. 清空购物车。cart.jsp
- 编程开发常用的英语单词