@RequestMapping(value = "/get/{id}/{userId}", method = RequestMethod.GET)
    public Result getMemberShip(@PathVariable("id") int id,@PathVariable("userId") int userId) {

假如id为非必需参数

 

//可以指定多个匹配路径

@RequestMapping(value = {"/get/{userId}", "/get/{id}/{userId}"}, method = RequestMethod.GET)


//然后设置参数非必须

@PathVariable(required = false) String id

 

相关文章:

  • 2021-11-07
  • 2022-03-09
  • 2021-06-20
  • 2021-10-21
  • 2021-10-21
  • 2022-02-20
  • 2021-10-19
猜你喜欢
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案