@RequestParam
@RequestParam用来处理 Content-Type 为 application/x-www-form-urlencoded 编码的内容,Content-Type默认为该属性。
@RequestParam也可用于除GET请求外,其它类型的请求,例如:POST、DELETE等请求。
不推荐使用@RequestParam接收application/json,这时候就需要使用到@RequestBody
实例:
1前端访问接口
2工具访问接口
![在这里插入图片描述](https://img-blog.csdnimg.cn/9c8226a92fd14a3d9bfa72eb03017a5d.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/e8f6f524f9314c4b995ba12e8c293d07.png)
后端成功接收到参数,传递成功。