org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'id' for method parameter type String is not present
客户端:
requestUserInfoById()const requestUserInfoById = async (id?: string) => {}
服务器端:
@GetMapping("/user/getUserProfile/{id}")public UserVO getUserProfile(@PathVariable("id") String id,
HttpServletRequest request, HttpServletResponse response) {}
解决方法:
public UserPO getUserInfoById(@RequestParam(name ="id",required=false)
String id,
HttpServletRequest request,
HttpServletResponse response){}