javaee / jersey

This is no longer the active Jersey repository. Please see the README.md
http://jersey.github.io
Other
2.86k stars 2.35k forks source link

Configurable.register(Object) should also handle injection of DynamicFeature. #3438

Open glassfishrobot opened 8 years ago

glassfishrobot commented 8 years ago

Hi,

According to the JAX-RS specification, register(Object) is meant to inject tt>@Context</tt (and I guess tt>@Inject</tt?) into the object.

Currently, it does so if the object implements Feature but it should at least do so also for DynamicFeature, and maybe other classes (I'm not sure how to interpret "JAX-RS component" in the citation below).

Here is two relevant documentation of javax.ws.rs.core.Configurable.register(Object):

The registered JAX-RS component is registered as a contract provider of all the recognized JAX-RS or implementation-specific extension contracts including meta-provider contracts, such as {@code Feature} or {@link javax.ws.rs.container.DynamicFeature}.

Fields and properties of all registered JAX-RS component instances are injected with their declared dependencies (see {@link Context}) by the JAX-RS runtime prior to use.

Affected Versions

[2.23.1]

glassfishrobot commented 8 years ago

Reported by victornoel

glassfishrobot commented 7 years ago

bricedutheil said: Indeed I'm surprised this specification part is not handled by Jersey / HK2.

It may really fix #2232

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JERSEY-3166