Resteasy多资源路径警告



我有一个服务类,有2个GET请求,如下所示,在日志中总是给我关于多个资源方法匹配请求

的警告
@Path("/a")
class Service{
    @Path("/{name}"
    @GET
    public A methodA(@PathParam("name") String name){return a;}
    @Path("/status")
    @GET
    public B methodB(){return b;}
}

有人知道这是为什么吗?我使用rest-easy版本3.0.8与spring 4.x.x

考虑到我对你上面问题的评论,我将重写我的控制器如下:

@Path("/a")
class Service{
            @Path("/{name}"
            @GET
            public ResponseEntity methodA(@PathParam("name") String name){
                if("status".equals(name) {
                  return new ResponseEntiry(b, OK);
                } else {
                    return new ResponseEntiry(a, OK);
                }
            }
}

相关内容

最新更新