我正在使用 spring-boot 1.4.3.RELEASE 来创建 Web 服务,而在使用 http://localhost:7211/person/get/ram
发出请求时,我的 id 属性为空
@RequestMapping(value="/person/get/{id}", method=RequestMethod.GET, produces="application/json")
public @ResponseBody Person getPersonById(@PathParam("id") String id) {
return personService.getPersonById(id);
}
你能建议我吗,有什么我错过的吗?
原文由 Ram Kowsu 发布,翻译遵循 CC BY-SA 4.0 许可协议
获取路径变量的注释是 @PathVariable 。看起来您使用了 @PathParam ,这是不正确的。
查看此内容以获取更多详细信息:
请求参数与路径变量