[
https://issues.apache.org/jira/browse/OWB-273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gurkan Erdogdu closed OWB-273.
------------------------------
Resolution: Fixed
Fix Version/s: M4
YING, thanks for comments and test cases. I have committed it with removing
disposal methods. One point, yor xml uses old style of OWB, I changed it as
follows <beans></beans> instead of <WebBeans></WebBeans>
> Given class is not annotated with @Alternative Exception when try to enable
> alternative producer/producer field beans
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: OWB-273
> URL: https://issues.apache.org/jira/browse/OWB-273
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Injection and Lookup
> Affects Versions: M3
> Reporter: YING WANG
> Assignee: Gurkan Erdogdu
> Priority: Minor
> Fix For: M4
>
> Attachments: alternative2.jar
>
>
> I have an alternative producer bean as follow. It seems that the
> AlternativesManager.addClazzAlternative( ) requires @Alternative to be
> annotated at the class level even if it is an alternative producer and throws
> the following exception.
> It is not necessary to add @Alternative at both class level and method level
> for a producer/producer field beans, right?
> =====EXCEPTION=======================================================================================
>
> org.apache.webbeans.exception.WebBeansConfigurationException: Given class :
> com.jcdi.test.alternative.producerbased.AlternativeBeanProducer2 is not
> annotated with @Alternative
> at
> org.apache.webbeans.inject.AlternativesManager.addClazzAlternative(AlternativesManager.java:89)
> at
> org.apache.webbeans.xml.WebBeansXMLConfigurator.addAlternative(WebBeansXMLConfigurator.java:622)
> at
> org.apache.webbeans.xml.WebBeansXMLConfigurator.configureAlternativesElement(WebBeansXMLConfigurator.java:587)
> at
> org.apache.webbeans.xml.WebBeansXMLConfigurator.configureSpecSpecific(WebBeansXMLConfigurator.java:323)
> at
> org.apache.webbeans.xml.WebBeansXMLConfigurator.configureSpecSpecific(WebBeansXMLConfigurator.java:221)
> at
> org.apache.webbeans.xml.WebBeansXMLConfigurator.configure(WebBeansXMLConfigurator.java:157)
> at
> org.apache.webbeans.config.BeansDeployer.deployFromXML(BeansDeployer.java:384)
> at
> org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:139)
> at
> org.apache.webbeans.lifecycle.WebApplicationLifeCycle.applicationStarted(WebApplicationLifeCycle.java:196)
> at
> org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:60)
> ===THE ALTERNATIVE PRODUCER
> BEAN===============================================================
> public class AlternativeBeanProducer2 {
> public @Produces @Alternative @QualifierProducerBased IProducedBean
> generateBean2(@New AlternativeBeanClass1 beanClass) {
> return new AbstractProducedBean(beanClass, this);
> }
> /*
> public void dumpBean2(
> @Disposes @QualifierProducer IProducedBean bean, ILog
> log) {
> log.log(bean + " is dumped by
> AlternativeBeanProducer2");
> }
> */
>
> }
> ========================================================================
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.