多地址调同一个方法

地址中可以用数组的
springboot的controller简单学习

方式传递参数

@PathVariable 获取url中的数据
@RequestParam获取请求参数的值
springboot的controller简单学习
springboot的controller简单学习

  • 第二种
  • springboot的controller简单学习
  • springboot的controller简单学习
  • 此时url中如果不传参会报错,此时的解决办法如下,在接口方法中,设置如下
  • springboot的controller简单学习
  • springboot的controller简单学习

相关文章: