<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>@Matej -&nbsp;Yes, that would be consistent with what I was seeing as well.</p>
<p><br>
</p>
<p>@Mark - Are you thinking about decorators and not alternatives? &nbsp;See also [1]</p>
<p>Really the goal here is to substitute the bean, but not just the provided bean the producer method that it exposes. &nbsp;It seems to work as I would expect it in weld (as mentioned), when I add @Produces to the method, it overrides the base class's producer
 method. &nbsp;No ambiguous resolutions, it just works properly.</p>
<p><br>
</p>
<p>Realistically, this is all an experiment to see if I can provide spring boot like default configurations (beans, config values, etc) in a framework,&nbsp;and override them as an application developer.</p>
<p><br>
</p>
<p><br>
</p>
<p>[1]:&nbsp;<a href="http://docs.jboss.org/cdi/spec/2.0.EDR2/cdi-spec.html#alternatives" class="OWAAutoLink" id="LPlnk123050">http://docs.jboss.org/cdi/spec/2.0.EDR2/cdi-spec.html#alternatives</a></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matej Novotny &lt;manovotn@redhat.com&gt;<br>
<b>Sent:</b> Monday, September 12, 2016 3:28 AM<br>
<b>To:</b> Mark Struberg<br>
<b>Cc:</b> John Ament; Emily Jiang; cdi-dev<br>
<b>Subject:</b> Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi all,<br>
<br>
I did some testing (with Weld) and it seems the scope IS inherited when you use @Alternative.<br>
However it IS NOT inherited when you use @Specialized.<br>
<br>
Not yet sure if this is intended or anyhow spec-defined, just stating facts.<br>
<br>
Matej<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Mark Struberg&quot; &lt;struberg@yahoo.de&gt;<br>
&gt; To: &quot;John Ament&quot; &lt;john.ament@spartasystems.com&gt;, &quot;Emily Jiang&quot; &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; Cc: &quot;cdi-dev&quot; &lt;cdi-dev@lists.jboss.org&gt;<br>
&gt; Sent: Monday, September 12, 2016 8:00:55 AM<br>
&gt; Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; &gt; Right now inheritance of managed beans is itself problematic, as<br>
&gt; <br>
&gt; &gt; injecting the base class can cause these ambiguous resolutions.<br>
&gt; <br>
&gt; Yes, that's why we originally introduced @Typed.<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Your sample wont work as an Alternative as it extends a concrete class and<br>
&gt; doesn't implement any interface.<br>
&gt; Did you mean @Specializes?<br>
&gt; Note that with @Alternative you won't make the original producer go away.You<br>
&gt; would also need to add @Alternative to the producer method imo. The rules<br>
&gt; for making an alternative producer method are really a bit confusing ;) I<br>
&gt; think the most portable way is to annotate both the class and the producer<br>
&gt; method with @Alternative.<br>
&gt; <br>
&gt; <br>
&gt; LieGrue,<br>
&gt; strub<br>
&gt; <br>
&gt; <br>
&gt; On Monday, 12 September 2016, 0:57, John Ament &lt;john.ament@spartasystems.com&gt;<br>
&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;Hi Emily,<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;I disagree, at least it doesn't add any new ambiguous injections.&nbsp; The<br>
&gt; &gt;use-case is specifically to Specialized/Alternative beans.&nbsp; Right now<br>
&gt; &gt;inheritance of managed beans is itself problematic, as injecting the base<br>
&gt; &gt;class can cause these ambiguous resolutions.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;The example I sent out actually works correctly (in weld at least), really<br>
&gt; &gt;my propose is to remove the need to have Produces a second time and update<br>
&gt; &gt;the spec to clarify what happens here (FWIW, I don't believe the case is<br>
&gt; &gt;currently described in the spec), hopefully to say that qualifiers and<br>
&gt; &gt;scopes from the base method remain in effect, unless explicitly overridden.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;John<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;________________________________<br>
&gt; &gt; <br>
&gt; &gt;From: Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; &gt;Sent: Sunday, September 11, 2016 5:59 PM<br>
&gt; &gt;To: John Ament<br>
&gt; &gt;Cc: cdi-dev<br>
&gt; &gt;Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
&gt; &gt; <br>
&gt; &gt;I think this is very problematic as you will get<br>
&gt; &gt;AmbiguousResolutionException all the time once we introduce this<br>
&gt; &gt;inheritance.<br>
&gt; &gt;<br>
&gt; &gt;Many thanks,<br>
&gt; &gt;Emily<br>
&gt; &gt;===========================<br>
&gt; &gt;Emily Jiang<br>
&gt; &gt;WebSphere Application Server, CDI Development Lead<br>
&gt; &gt; <br>
&gt; &gt;MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
&gt; &gt;Phone:&nbsp; &#43;44 (0)1962 816278&nbsp; Internal: 246278<br>
&gt; &gt;<br>
&gt; &gt;Email: emijiang@uk.ibm.com<br>
&gt; &gt;Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;From:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; John Ament &lt;john.ament@spartasystems.com&gt;<br>
&gt; &gt;To:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cdi-dev &lt;cdi-dev@lists.jboss.org&gt;<br>
&gt; &gt;Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11/09/2016 20:04<br>
&gt; &gt;Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [cdi-dev] Should javax.enterprise.inject.Produces be<br>
&gt; &gt;inherited?<br>
&gt; &gt;Sent by:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cdi-dev-bounces@lists.jboss.org<br>
&gt; &gt;&gt;________________________________<br>
&gt; &gt; <br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;All,<br>
&gt; &gt;<br>
&gt; &gt;I was just thinking about alternatives and producer methods.&nbsp; Suppose I have<br>
&gt; &gt;the following bean:<br>
&gt; &gt;<br>
&gt; &gt;@ApplicationScoped<br>
&gt; &gt;public class Boop {<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; @Produces<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; @ApplicationScoped<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; public Simpler makeSimpler() {<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new Simpler(&quot;Boop&quot;);<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; }<br>
&gt; &gt;}<br>
&gt; &gt;<br>
&gt; &gt;If I want to override the producer method, I need to declare fully:<br>
&gt; &gt;<br>
&gt; &gt;@Alternative<br>
&gt; &gt;@Priority(100)<br>
&gt; &gt;@ApplicationScoped<br>
&gt; &gt;public class BoopAlternative extends Boop{<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; @Override<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; @Produces<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; public Simpler makeSimpler() {<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new Simpler(&quot;Boop2&quot;);<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; }<br>
&gt; &gt;}<br>
&gt; &gt;<br>
&gt; &gt;For some reason, scopes are inherited, but the produces annotation is not.<br>
&gt; &gt;At least in the case of a producer method, it seems like it would be<br>
&gt; &gt;useful for @Produces to be inherited as well.<br>
&gt; &gt;<br>
&gt; &gt;John<br>
&gt; &gt;<br>
&gt; &gt;________________________________<br>
&gt; &gt; NOTICE: This e-mail message and any attachments may contain confidential,<br>
&gt; &gt; proprietary, and/or privileged information which should be treated<br>
&gt; &gt; accordingly. If you are not the intended recipient, please notify the<br>
&gt; &gt; sender immediately by return e-mail, delete this message, and destroy all<br>
&gt; &gt; physical and electronic copies. Thank you.<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt;cdi-dev mailing list<br>
&gt; &gt;cdi-dev@lists.jboss.org<br>
&gt; &gt;<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" id="LPlnk782305">https://lists.jboss.org/mailman/listinfo/cdi-dev</a>
<div id="LPBorder_GT_14736829551610.8553955583667863" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14736829551590.4297440938060402" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14736829551600.36937585901394154" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14736829551600.10709433126010759"></div>
<div id="LPTitle_14736829551600.8229290518840873" style="top: 0px; color: rgb(227, 30, 37); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, &quot;Segoe UI Light&quot;, &quot;Segoe WP Light&quot;, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14736829551600.5465808981178195" href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank" style="text-decoration: none;">cdi-dev Info Page - JBoss Developer</a></div>
<div id="LPMetadata_14736829551610.5186492591118401" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.jboss.org</div>
<div id="LPDescription_14736829551610.42768281144429676" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
List to discuss the development of CDI (the specification) To see the collection of prior postings to the list, visit the cdi-dev Archives.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
&gt; &gt;<br>
&gt; &gt;Note that for all code provided on this list, the provider licenses the code<br>
&gt; &gt;under the Apache License, Version 2<br>
&gt; &gt;(<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas<br>
&gt; &gt;provided on this list, the provider waives all patent and other<br>
&gt; &gt;intellectual property rights inherent in such information.<br>
&gt; &gt;cdi-dev Info Page - JBoss Developer<br>
&gt; &gt;lists.jboss.org<br>
&gt; &gt;List to discuss the development of CDI (the specification) To see the<br>
&gt; &gt;collection of prior postings to the list, visit the cdi-dev Archives.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;Unless stated otherwise above:<br>
&gt; &gt;IBM United Kingdom Limited - Registered in England and Wales with number<br>
&gt; &gt;741598.<br>
&gt; &gt;Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;________________________________<br>
&gt; &gt; NOTICE: This e-mail message and any attachments may contain confidential,<br>
&gt; &gt; proprietary, and/or privileged information which should be treated<br>
&gt; &gt; accordingly. If you are not the intended recipient, please notify the<br>
&gt; &gt; sender immediately by return e-mail, delete this message, and destroy all<br>
&gt; &gt; physical and electronic copies. Thank you.<br>
&gt; &gt;<br>
&gt; &gt;_______________________________________________<br>
&gt; &gt;cdi-dev mailing list<br>
&gt; &gt;cdi-dev@lists.jboss.org<br>
&gt; &gt;<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">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<br>
&gt; &gt;under the Apache License, Version 2<br>
&gt; &gt;(<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas<br>
&gt; &gt;provided on this list, the provider waives all patent and other<br>
&gt; &gt;intellectual property rights inherent in such information.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; _______________________________________________<br>
&gt; cdi-dev mailing list<br>
&gt; cdi-dev@lists.jboss.org<br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt; <br>
&gt; Note that for all code provided on this list, the provider licenses the code<br>
&gt; under the Apache License, Version 2<br>
&gt; (<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas<br>
&gt; provided on this list, the provider waives all patent and other intellectual<br>
&gt; property rights inherent in such information.<br>
&gt; <br>
</div>
</span></font></div>
</div>
<hr>
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this
 message, and destroy all physical and electronic copies. Thank you.
</body>
</html>