获取附加资源的 JAX-RS 应用程序

Get the JAX-RS application a resource is attached on

我想知道是否有可能获得 JAX-RS 的实例 Application 资源附加在上面。理想情况下,一种不依赖于特定实现的方式。例如使用依赖注入...

非常感谢您的帮助, 蒂埃里

The Spec

所述

5.2.1 Application

The instance of the application-supplied Application subclass can be injected into a class field or method parameter using the @Context annotation. Access to the Application subclass instance allows configuration information to be centralized in that class. Note that this cannot be injected into the Application subclass itself since this would create a circular dependency.

但根据我的经验,它很可能不是实际实例,而是代理。另外,如果您想对其进行任何更改,我不确定是否可行。它可能是只读的。