cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reta <...@git.apache.org>
Subject [GitHub] cxf pull request #181: ensuring CDI Bean<?> are always the CDI context ones
Date Thu, 20 Oct 2016 17:37:42 GMT
Github user reta commented on a diff in the pull request:

    https://github.com/apache/cxf/pull/181#discussion_r84336679
  
    --- Diff: integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
---
    @@ -74,16 +74,16 @@
                 featureBeans.add((Bean< ? extends Feature >)event.getBean());
             } else if (CdiBusBean.CXF.equals(event.getBean().getName())
                     && Bus.class.isAssignableFrom(event.getBean().getBeanClass()))
{
    -            busBean = event.getBean();
    +            hasBus = true;
             }
         }
     
         public void load(@Observes final AfterDeploymentValidation event, final BeanManager
beanManager) {
    +        // no need of creational context, it only works for app scoped instances anyway
    +        final Bean<?> busBean = beanManager.resolve(beanManager.getBeans(CdiBusBean.CXF));
             bus = (Bus)beanManager.getReference(
    --- End diff --
    
    @rmannibucau This is kind of worries me, Bean< ? > is essentially a piece of metadata.
There is no hacks or backdoors we use here to get the instance of the Bean< ? >, everything
is relying on CDI API. So if there are multiple ways to retrieve Bean< ? > instances,
as a developer/user, I would expect to have the same result at the end. It seems like this
does not hold true and is implementation specific, as you pointed out. I think the fix should
target not `bus` only so we won't get back to this issue again. Does it make sense?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message