reta opened a new pull request #346: CXF-7544: Support @Context-based injection 
into proxied CDI beans
URL: https://github.com/apache/cxf/pull/346
 
 
   The issue pop up as part of #330 discussion. In case when provider / feature 
/ resource is a proxied CDI bean, the contextual class members (annotated with 
@context) are not injected.
   
   More broadly, in some circumstances (like using @ApplicationScoped 
annotation for example) the CDI runtime will create a proxy class for a 
particular bean. As the result, the CXF side is going to bind the particular 
provider metadata to this proxy instance. It looks logical and unambiguous.
   
   However, the interesting things are happening when CXF will try to inject 
contextual proxies (@Context annotations) into the provider instance. The 
injections are successful but the target object for them will be the proxy 
instance (not the real instance behind it). Consequently, at runtime, when the 
proxy delegates the call to a backing instance, all contextual proxies are null 
in there (simply put, not set).
   
   @johnament @rmannibucau Addressing the issue requires a significant revamp 
of the CXF injection mechanism, it is turned out to be hard to solve even with 
`@AroundConstruct` or, previously, provifing custom `@Context` injectors. The 
good news is that the field-based injection could be easily workarounded using 
setter-based injection. After conversations with @sberyozkin, we decided that 
encapsulating CXF injection implementation and than delegating the hard work to 
appropriate strategy (CDI, Spring, ...) would be better time investment than 
trying to patch the existing one. Since we have simple workaround, it sounds 
like an acceptable tradeoff (https://issues.apache.org/jira/browse/CXF-7571).
   
   This PR fixes the patterns in `CdiClassUnwrapper`, adds tests for it and 
fixes the `FilterProviderInfo` resource / service class resolution (to match it 
to the `ProviderInfo`)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to