在写接口时:加或不加@RequestParam注解的区别
@RequestParam注解的作用及用法

第一种写法参数为非必传,第二种写法参数为必传。参数名为id

第二种写法可以通过@RequestParam(required = false)设置为非必传。因为required值默认是true,所以默认必传

第二种写法也可以通过@RequestParam(“id”)或者@RequestParam(value = “id”)指定参数名

第二种写法可以通过@RequestParam(defaultValue = “0”)指定参数默认值

用法如下:
@RequestParam注解的作用及用法

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
猜你喜欢
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-01-07
相关资源
相似解决方案