Martin Kouba created OWB-1209:
---------------------------------

             Summary: Custom bean with isAlternative()=true should not be 
automatically enabled
                 Key: OWB-1209
                 URL: https://issues.apache.org/jira/browse/OWB-1209
             Project: OpenWebBeans
          Issue Type: Bug
            Reporter: Martin Kouba


It seems that if you register a custom bean where {{isAlternative()}} returns 
true, the bean is automatically enabled. However, the container should use 
{{getBeanClass()}}, see also "Declaring selected alternatives for a bean 
archive":
{quote}
For a custom implementation of the Bean interface defined in The Bean 
interface, the container calls isAlternative() to determine whether the bean is 
an alternative, and getBeanClass() and getStereotypes() to determine whether an 
alternative is selected in a certain bean archive.
{quote}

Moreover, if I specify the bean class of a custom bean in the {{beans.xml}} I 
get :
{noformat}
Given alternative class : org.jboss.cdi.builtinbeans.IntegerEventBean is not 
annotated wih @Alternative or not an enabled bean
{noformat}

To reproduce, checkout https://github.com/mkouba/alternative-builtin-beans and 
modify 
https://github.com/mkouba/alternative-builtin-beans/blob/master/src/test/java/org/jboss/cdi/builtinbeans/BeansXml.java#L25
 to always return beans.xml with enablement. Then run:

{noformat}
mvn clean test -DcdiImpl=owb1
{noformat}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to