-
Bug
-
Resolution: Done
-
Critical
-
2.0.GA
-
None
-
None
-
Release Notes
The default RESTEasy process for creating a component instance is the following:
1.) Obtain an instance by calling ConstructorInjector.construct(class)
2.) Perform JAX-RS injection by calling PropertyInjector.inject(instance)
However, in CDI environment the PropertyInjector.inject() call would fail (Since the ConstructorInjector returns a proxied instance) Therefore, in a CDI environment, JAX-RS property injection is done during bean instantiation.
As a result, PropertyInjector.inject() would be called twice:
1.) - by the resteasy-cdi extension during bean instantiation
2.) - by RESTEasy (this attempt would fail with exception since Weld proxies throw IllegalArgumentException on field injection attempt)
In order to avoid double property injection, the CdiInjectorFactory return a NoopPropertyInjector. This works as expected for CDI-enabled JAX-RS components but causes JAX-RS property injection not to work for non-CDI-enabled JAX-RS components in a CDI-enabled deployment. (i.e. a CDI-enabled war archive that bundles a non-CDI archive with a set of providers - i.e. JSON support)