[cdi-dev] [JBoss JIRA] (CDI-574) Should a disabled @Specialized disable a second bean?

Emily Jiang emijiang6 at googlemail.com
Tue Nov 24 12:07:50 EST 2015


Here is the file

On Tue, Nov 24, 2015 at 4:40 PM, Antoine Sabot-Durand (JIRA) <
issues at jboss.org> wrote:

>
>     [
> https://issues.jboss.org/browse/CDI-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13133410#comment-13133410
> ]
>
> Antoine Sabot-Durand commented on CDI-574:
> ------------------------------------------
>
> Sorry Emily. I understand roughly your question, but could you detail your
> use case. You're talking about producer, there is not code for them. I
> don't understand where the CounterProducerConsumerModified2 bean is defined.
> From here it looks like a corner case, but I may be wrong. Could you
> format your code and add your whole example. Thx.
>
> > Should a disabled @Specialized disable a second bean?
> > -----------------------------------------------------
> >
> >                 Key: CDI-574
> >                 URL: https://issues.jboss.org/browse/CDI-574
> >             Project: CDI Specification Issues
> >          Issue Type: Clarification
> >          Components: Inheritance and Specialization
> >    Affects Versions: 1.2.Final
> >         Environment: n/a
> >            Reporter: Emily Jiang
> >
> > In CDI specification Section 4.3:
> > When an enabled bean, as defined in Section 5.1.2, “Enabled and disabled
> beans”, specializes a second bean, we can be certain that the second bean
> is never instantiated or called by the container. Even if the second bean
> defines a producer or observer method, the method will never be called.
> > The spec says only an enabled bean can specialize a second bean. Can a
> disabled specialized bean specialize a second bean?
> > Weld asserts a disabled specialized bean specializes a second bean while
> OWB asserts a disabled specialized bean does not specialize a second bean.
> > This needs to be clarified.
> > In more details:
> > I have an application containing two wars.
> > testDiffBDA.war
> > testDiffBDA.war/WEB-INF/classes/test/diff/web/FrontEndServlet.class
> > @Inject CounterProducerConsumerModified2 bean;
> > beans-xml-modified2.jar
> > containing one bean and an empty-ish beans.xml :
> > @Inject at CounterModifiedQualifier String modifiedProducer;
> > beans-xml-modified.jar.jar
> > CounterModifiedQualifier  (the interface)
> > CounterProducerModified (the bean implementing that interface)
> > AlternativeCounterProducerModified (an alternative specialized bean)
> >  beans.xml
> >    <alternatives>
> >
>  <class>com.ibm.jcdi.test.beansxml.AlternativeCounterProducerModified</class>
> >    </alternatives>
> > My application failed deployment with the error on Weld but worked on
> OpenWebBeans
> > {code}
> > [ERROR   ] CWWKZ0004E: An exception occurred while starting the
> application testDiffBDA. The exception message was:
> com.ibm.ws.container.service.state.StateChangeException:
> org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied
> dependencies for type String with qualifiers @CounterModifiedQualifier
> >   at injection point [BackedAnnotatedField] @Inject
> @CounterModifiedQualifier
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer
> >   at
> com.ibm.jcdi.test.beansxml.CounterProducerConsumerModified2.modifiedProducer(CounterProducerConsumerModified2.java:0)
> > {code}
> > After further investigation and talking to Martin from Weld, the error
> was caused due to the fact of AlternativeCounterProducerModified disabling
> the CounterProducerModified bean but itself is not enabled in the jar of
> beans-xml-modified2.jar. Therefore, no producer is active to produce a bean
> with the qualifier CounterModifiedQualifier.
> > From Weld's perspective, any bean annotated with @Specialized disables a
> second bean regardless whether itself is active or not.
> > My understanding is that the specialized should only take effect if
> itself is enabled. Otherwise, we run into the situation of where the
> specialized bean is not enabled but it disabled another bean. To me, it is
> wrong.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.4.11#64026)
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
>



-- 
Thanks
Emily
=================
Emily Jiang
ejiang at apache.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20151124/f1bdf820/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testDiffBDA.war
Type: application/octet-stream
Size: 7618 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/cdi-dev/attachments/20151124/f1bdf820/attachment-0001.obj 


More information about the cdi-dev mailing list