Github user rmannibucau commented on a diff in the pull request:

    https://github.com/apache/cxf/pull/181#discussion_r84338315
  
    --- 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 --
    
    Concretely there is a single reliable way - resolve(getBeans()). That said 
the cases where this is an issue for providers and resources are very limit 
today for JAX-RS (but can create some nice feature if CXF embraces - typically 
reading metadata like @Path from cdi AnnotatatedMethod instead of doing pure 
reflection).
    
    For features this is a valid point I think.
    
    So concretely what does it mean? That discovered instances through CDI 
scanning (collect()) is only valid for @Produces or managed bean. Think it is 
fair to start with that but happy to try to do another PR fixing it more if you 
think it makes 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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to