org.springframework.web.bind.MissingPathVariableException: Missing URI template variable 'token' for method parameter of type String

时间:2020-09-18 03:34:26   收藏:0   阅读:47

spring boot项目中报此错误,可能的原因是

  1. 在GetMapping中没有指定参数名

    @GetMapping("/verifyLogin")
    public HttpResult verifyLogin(@PathVariable("token") String token)
    

    正确的应该是:

    @GetMapping("/verifyLogin/{token}")
    public HttpResult verifyLogin(@PathVariable("token") String token)
    
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!