"Could not find a suitable constructor" 当从我的资源中提取接口时 class 使用 Jersey 2

"Could not find a suitable constructor" when extracted interface from my resource class with Jersey 2

如何让 Jersey 理解它应该使用具体的 class 而不是资源的接口?

我有一个带有 Status 资源的工作应用程序。然后我提取了一个接口 IStatus,并将所有 JAX-RS 注释移到那里。现在,我得到:

org.glassfish.hk2.api.MultiException A MultiException has 1 exceptions.  They are:1. java.lang.NoSuchMethodException: Could not find a suitable constructor in resource.IStatus class

我知道这适用于 RestEasy。有什么方法可以让它与 Jersey 一起使用吗?

将 class 级别 @Path 放在实现而不是接口上。 Jersey 正在尝试实例化接口,但它不能。

对于到达此线程的任何人,以上不是问题,在我的情况下是这样的:

Please pay special attention to constructors annotated with @Inject. It is a common mistake to import com.google.Inject instead of javax.inject.Inject.

从这里开始: https://github.com/eclipse-ee4j/jersey/issues/2390

问题解决了!