java.lang.IllegalStateException: PathVariable/RequestParam annotation was empty on param 0.
生活随笔
收集整理的這篇文章主要介紹了
java.lang.IllegalStateException: PathVariable/RequestParam annotation was empty on param 0.
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
這個異常是我在啟動Spring項目時遇到的,然后報這個異常導致項目啟動不起來,解決方法:
在@PathVariable這個注解后面加上value值。
這個是我報異常的代碼:
這個是修改后的代碼
@GetMapping("/user/{id}")CommonResult<User> getUser(@PathVariable("id") Long id);@GetMapping("/user/getByUsername")CommonResult<User> getByUsername(@RequestParam("username") String username);總結
以上是生活随笔為你收集整理的java.lang.IllegalStateException: PathVariable/RequestParam annotation was empty on param 0.的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle用户锁定及修改密码
- 下一篇: com.netflix.zuul.exc