SpringBoot:错误Missing URI template variable '币种ID' for method parameter of type int

调试接口时候,Missing URI template variable '币种ID' for method parameter of type int。

1     @ApiOperation(value = "销毁金额")
2     @PostMapping("/destroy/{currency_id}")
3     public Result destroyMoney(@PathVariable(value="币种ID") int currency_id) {
4         return fundsService.destroyMoney(currency_id);
5     }
6         

后来发现,不能在@PathVariable有value和name,下面这样就行:

1     @ApiOperation(value = "销毁金额")
2     @PostMapping("/destroy/{currency_id}")
3     public Result destroyMoney(@PathVariable("currency_id") int currency_id) {
4         return fundsService.destroyMoney(currency_id);
5     }

如果需要对参数说明,可以@ApiParam。

posted @ 2020-05-25 15:54  Ivy_Xu  阅读(2446)  评论(0编辑  收藏  举报