@RequestMapping参数有无默认值
时间: 2023-08-26 07:07:01 浏览: 99
简化版@requestmapping注解注册源码
5星 · 资源好评率100%
@RequestMapping参数有默认值。在@RequestMapping注解中,value参数指定了URL请求的实际地址,它是@RequestMapping的默认值。如果没有显式地指定value参数,那么默认值就是空字符串。例如,在控制器的类定义处添加@RequestMapping注解时,可以省略value参数,相当于多了一层访问路径。而在方法定义处添加@RequestMapping注解时,必须显式地指定value参数,表示该方法对应的URL请求路径。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* [Spring MVC 常用注解、@RequestMapping 常用参数、参数绑定( RESTful 、映射 Cookie、使用POJO 绑定参数)](https://blog.csdn.net/weixin_44152682/article/details/124481409)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Spring Boot注解@RequestMapping、@RequestBody的详解](https://blog.csdn.net/qq_20957669/article/details/87686899)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文