<p dir="ltr">@jozef: if you get interceptors for instance from an injected bm you dont get your app ones but jar ones even from a war which breaks comon usages as well as classloader design where location doesnt mean anything for cdi.<br>
</p>
<div class="gmail_quote">Le 18 févr. 2015 16:48, &quot;Mark Struberg&quot; &lt;<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>&gt; a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Again, just trying to understand how it works in Weld.<br>
<br>
Lets do the following example: MessageBundleExtension in DeltaSpike [1].<br>
<br>
We have an<br>
public interface @MessageBundle MsgInEar { .. }<br>
in a shared ear lib jar and a second one<br>
public interface @MessageBundle MsgInWar { .. }<br>
in WEB-INF/classes of war1.<br>
<br>
In Weld there is only 1 instance of the MessageBundleExtension for the whole EAR, right?<br>
<br>
This extension first collects all the classes annotated with @MessageBundle in a Set&lt;Class&lt;?&gt;&gt; via @Observes ProcessAnnotatedType.<br>
And in @Observes AfterBeanDiscovery we create Bean&lt;T&gt; for all those found classes and add all those to the BeanManager we get as parameter.<br>
<br>
Questions:<br>
Q1: Which BeanManager do I get here?<br>
Q2: And what happens if I add a Bean with a Type X in war1 and another Bean with Type X in war2 via AfterBeanDiscovery#addBean()?<br>
Q3: Does this create an AmbiguousResolutionException when used?<br>
<br>
LieGrue,<br>
strub<br>
<br>
PS: I am well aware that all the other solutions also have some very nasty side effects…<br>
<br>
[1] <a href="http://deltaspike.apache.org/documentation/core.html#_messages_and_i18n" target="_blank">http://deltaspike.apache.org/documentation/core.html#_messages_and_i18n</a><br>
<br>
<br>
&gt; Am 18.02.2015 um 15:54 schrieb Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com">jharting@redhat.com</a>&gt;:<br>
&gt;<br>
&gt;<br>
&gt; On 02/18/2015 03:19 PM, Mark Struberg wrote:<br>
&gt;&gt; I fear the clash in bean names across different WARs is a bug which is the direct consequence of Weld only has 1 ‚User BeanManager‘. It seems there are multiple kind of BeanManagers in Weld. The one that Jozef already describes is the ‚BDA BeanManager‘. But there must be another one.<br>
&gt; That was an old bug in JBoss AS 7. It is fixed in both WildFly and JBoss EAP.<br>
&gt;&gt;  What happens to all the AfterBeanDiscovery#addBean() beans? Where do they get stored in App servers using Weld?<br>
&gt; That should be an implementation detail. What matters where the bean is visible from - i.e. if the bean class comes from a shared lib, it should be visible globally whereas if it comes from a war it should not be visible from another war.<br>
&gt;&gt;<br>
&gt;&gt; What happens to BeforeBeanDiscovery#addScope and AfterBeanDiscovery#addContext ?<br>
&gt;&gt; If I package deltaspike-jsf (which activates the a few JSF related Contexts) in one of my WARs, do I get those also for my other WARs? What if a 2nd war tries to register the same Context? I guess this is what Romain meant when he wanted to treat each WAR as (mostly) isolated unit.<br>
&gt;&gt;<br>
&gt;&gt; Arjans experience is only the tip of the iceberg.<br>
&gt;&gt; @Arjan, I would be interested if you would run your tests against TomEE-1.7.2-SNAPSHOT. I expect this is also broken as you added lots of workarounds to get it running on Weld. But still would love to know how far (or not) portability goes.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I do fully agree with „1 Extension instance per Application“ paragraph. But the important question is what Appliation means. This is by far not clear. The EE spec for example talks about „multiple Applications in an EAR“ in some paragraphs (meaning Web-Apps it seems). So both interpretations are ok by the strict spec wording.<br>
&gt;&gt;<br>
&gt;&gt; Of course, the other approaches have their downsides as well…<br>
&gt;&gt;<br>
&gt;&gt; LieGrue,<br>
&gt;&gt; strub<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; Am 18.02.2015 um 12:02 schrieb arjan tijms &lt;<a href="mailto:arjan.tijms@gmail.com">arjan.tijms@gmail.com</a>&gt;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Wed, Feb 18, 2015 at 10:37 AM, Mark Struberg &lt;<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt; <a href="https://struberg.wordpress.com/2015/02/18/cdi-in-ears/" target="_blank">https://struberg.wordpress.com/2015/02/18/cdi-in-ears/</a><br>
&gt;&gt;&gt; Interesting write up!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Over at OmniFaces we had some major issues with this as well, and<br>
&gt;&gt;&gt; blogged about that experience a little over a year ago. See<br>
&gt;&gt;&gt; <a href="http://balusc.blogspot.com/2013/10/cdi-behaved-unexpectedly-in-ear-so.html" target="_blank">http://balusc.blogspot.com/2013/10/cdi-behaved-unexpectedly-in-ear-so.html</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; We also compiled an overview of what works and doesn&#39;t work with CDI<br>
&gt;&gt;&gt; and ears from our perspective here:<br>
&gt;&gt;&gt; <a href="https://github.com/omnifaces/omnifaces/wiki/Known-Issues-(CDI)" target="_blank">https://github.com/omnifaces/omnifaces/wiki/Known-Issues-(CDI)</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Kind regards,<br>
&gt;&gt;&gt; Arjan Tijms<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; There was a lively discussion on twitter but 140 chars is way too restrictive to have a good flow ;)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; So please lets continue the arguments over here.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; LieGrue,<br>
&gt;&gt;&gt;&gt; strub<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; cdi-dev mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; cdi-dev mailing list<br>
&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;<br>
&gt;&gt; Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
&gt;<br>
<br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.</blockquote></div>