【发布时间】:2017-05-30 04:08:11
【问题描述】:
我正在使用 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);
}
你能建议我吗,我有什么遗漏的吗?
【问题讨论】:
-
"@PathParam" 是 JAX-RS 注释,用于类似 Jersey 的实现。 Spring 等效注解是“@PathVariable”。
标签: spring-boot