其他分享
首页 > 其他分享> > SpringBoot:错误Missing URI template variable '币种ID' for method parameter of type int

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。

标签:SpringBoot,Missing,int,destroyMoney,value,currency,id,PathVariable
来源: https://www.cnblogs.com/ivy-xu/p/12957347.html