[ 
https://issues.apache.org/jira/browse/OWB-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269479#comment-13269479
 ] 

Mark Struberg commented on OWB-667:
-----------------------------------

Hi Phil!

Thanks for the report! I guess this is a duplicate of OWB-658 ?
Can you please check the explanation there?

The core part is that getBeans is *not* defined to return all Beans of the 
given class, but to return all beans which are subject to be injected into an 
InjectionPoint of the given type! And if you have an @Alternative involved for 
that type, all other beans are disabled for this injection.

I fear it's just not a good idea to use getBeans as replacement for the 
java.util.ServiceLoader. We maybe need to think about portable ways to do such 
stuff in CDI.

In my big app I just fire a CDI Event 'registerMyServices' which has a 
#addService(YourService s) method to pick up all implementations.
                
> Bean queries have strange behavior (difference between Open Web Beans and the 
> Reference Implementation)
> -------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-667
>                 URL: https://issues.apache.org/jira/browse/OWB-667
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.4
>         Environment: All
>            Reporter: Phil Oser
>            Assignee: Gurkan Erdogdu
>         Attachments: cdi-boot.zip
>
>
> We use the BeanManager#getBeans(java.lang.reflect.Type, 
> java.lang.annotation.Annotation...) to find all beans of a certain type (to 
> implement something like a service locator).
> As soon as one of the beans is an activated Alternative, the list of matching 
> beans is reduced to this activated Alternative.
> The expected behavior is present in the Reference Implementation. 
> Please refer to the attached test cases.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to