警告:(sub)resource方法包含空路径注释 [英] WARNING: The (sub)resource method contains empty path annotation

查看:775
本文介绍了警告:(sub)resource方法包含空路径注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置了"/v1/"之类的休息路径,并在servlet中配置了"/test/"之类的端点.

I have configured rest path like "/v1/" and the endpoint configured in servlet like '/test/'.

现在,我从Java类"Test"中删除了"/v1".

Now I removed the "/v1" from the java class "Test".

org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: The (sub)resource method test in com.abc.services.Test contains empty path annotation.

进行此更改后,我收到了以上警告.如何处理此警告?

I got the above warning after make this change. How to handle this warning?

我希望这个"/v1"删除10条剩余路径的更改.有人帮我在没有警告的情况下跑步吗?

And I want this "/v1" removing changes for across 10 rest paths. So anyone help me to run without warnings?

推荐答案

警告表示您具有用@Path("/")@Path("")注释的资源方法.例如

The warning means you have a resource method annotated with @Path("/") or @Path(""). For instance

@Path("test")
public class Test {

    @GET
    @Path("/")
    public String test(){}
}

不知道为什么泽西岛会发出警告,也许只是为了确保这就是您真正想要的.原因是带有@Path("/")的资源方法是多余的,因为如果您只是想做

Not sure why Jersey would give a warning, maybe just to make sure that's what you really want. The reason is that a resource method with @Path("/") is redundant, as it's already implied if you were just to do

@Path("test")
public class Test {

    @GET
    public String test(){}
}

,没有@Path("/").它的工作原理相同.因此,如果有这些,请将其删除,它应该会删除警告.

without the @Path("/"). It works the same. So if you have these, remove them, and it should take away the warnings.

这篇关于警告:(sub)resource方法包含空路径注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆