You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2017/08/09 16:58:00 UTC

[jira] [Resolved] (OWB-1209) Custom bean with isAlternative()=true should not be automatically enabled

     [ https://issues.apache.org/jira/browse/OWB-1209?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-1209.
--------------------------------
    Resolution: Not A Problem
      Assignee: Mark Struberg

In OWB we use the section 5 definition of BDA. Means a BDA is per Module
And for each Module we have a separate BeanManager.
Only active Beans make it to the list of available Beans for BeanManager.getBeans();
If someone adds an Alternative Bean via an Extension then it's assumed that is is active for this Module.

> 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
>            Assignee: Mark Struberg
>
> 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)