Reputation: 202326
I wonder if it's possible to get an instance of the JAX-RS Application
a resource is attached on. Ideally a way that isn't dependent to a specific implementation. For example using dependency injection...
Thanks very much for your help, Thierry
Upvotes: 1
Views: 249
Reputation: 209112
As stated in 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 theApplication
subclass instance allows configuration information to be centralized in that class. Note that this cannot be injected into theApplication
subclass itself since this would create a circular dependency.
but from I've experienced, it will most likely not be the actual instance, but a proxy. Also if you're looking to alter anything on it, I'm not sure it's possible. It might be read-only.
Upvotes: 3