面对@PathParam注释的问题

时间:2018-05-05 07:47:39

标签: spring

我正在尝试使用GET通过URL传递一些数据,但我无法检索该数据。

网址:localhost:8080 / refresh-stats / abc 当我打印类型的值然后我得到Null而不是“abc”。

下面是我放置@PathParam注释的方法。这是在一个接口下,我在其他一些类中实现了下面的方法。

@GET
@Path("/refresh-stats/{tpye}")
@Produces(MediaType.APPLICATION_JSON)
public Response getRefreshStats(@PathParam("type") String type);

1 个答案:

答案 0 :(得分:1)

参数名称中有拼写错误。将此@Path("/refresh-stats/{tpye}")更正为@Path("/refresh-stats/{type}"),然后重试!!