<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 - 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? 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. 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. 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, and override them as an application developer.</p>
<p><br>
</p>
<p><br>
</p>
<p>[1]: <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 <manovotn@redhat.com><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> </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>
> From: "Mark Struberg" <struberg@yahoo.de><br>
> To: "John Ament" <john.ament@spartasystems.com>, "Emily Jiang" <EMIJIANG@uk.ibm.com><br>
> Cc: "cdi-dev" <cdi-dev@lists.jboss.org><br>
> Sent: Monday, September 12, 2016 8:00:55 AM<br>
> Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
> <br>
> <br>
> <br>
> > Right now inheritance of managed beans is itself problematic, as<br>
> <br>
> > injecting the base class can cause these ambiguous resolutions.<br>
> <br>
> Yes, that's why we originally introduced @Typed.<br>
> <br>
> <br>
> <br>
> Your sample wont work as an Alternative as it extends a concrete class and<br>
> doesn't implement any interface.<br>
> Did you mean @Specializes?<br>
> Note that with @Alternative you won't make the original producer go away.You<br>
> would also need to add @Alternative to the producer method imo. The rules<br>
> for making an alternative producer method are really a bit confusing ;) I<br>
> think the most portable way is to annotate both the class and the producer<br>
> method with @Alternative.<br>
> <br>
> <br>
> LieGrue,<br>
> strub<br>
> <br>
> <br>
> On Monday, 12 September 2016, 0:57, John Ament <john.ament@spartasystems.com><br>
> wrote:<br>
> ><br>
> >Hi Emily,<br>
> ><br>
> ><br>
> >I disagree, at least it doesn't add any new ambiguous injections. The<br>
> >use-case is specifically to Specialized/Alternative beans. Right now<br>
> >inheritance of managed beans is itself problematic, as injecting the base<br>
> >class can cause these ambiguous resolutions.<br>
> ><br>
> ><br>
> >The example I sent out actually works correctly (in weld at least), really<br>
> >my propose is to remove the need to have Produces a second time and update<br>
> >the spec to clarify what happens here (FWIW, I don't believe the case is<br>
> >currently described in the spec), hopefully to say that qualifiers and<br>
> >scopes from the base method remain in effect, unless explicitly overridden.<br>
> ><br>
> ><br>
> >John<br>
> ><br>
> ><br>
> ><br>
> >________________________________<br>
> > <br>
> >From: Emily Jiang <EMIJIANG@uk.ibm.com><br>
> >Sent: Sunday, September 11, 2016 5:59 PM<br>
> >To: John Ament<br>
> >Cc: cdi-dev<br>
> >Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
> > <br>
> >I think this is very problematic as you will get<br>
> >AmbiguousResolutionException all the time once we introduce this<br>
> >inheritance.<br>
> ><br>
> >Many thanks,<br>
> >Emily<br>
> >===========================<br>
> >Emily Jiang<br>
> >WebSphere Application Server, CDI Development Lead<br>
> > <br>
> >MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
> >Phone: +44 (0)1962 816278 Internal: 246278<br>
> ><br>
> >Email: emijiang@uk.ibm.com<br>
> >Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
> ><br>
> ><br>
> ><br>
> ><br>
> >From: John Ament <john.ament@spartasystems.com><br>
> >To: cdi-dev <cdi-dev@lists.jboss.org><br>
> >Date: 11/09/2016 20:04<br>
> >Subject: [cdi-dev] Should javax.enterprise.inject.Produces be<br>
> >inherited?<br>
> >Sent by: cdi-dev-bounces@lists.jboss.org<br>
> >>________________________________<br>
> > <br>
> ><br>
> ><br>
> >All,<br>
> ><br>
> >I was just thinking about alternatives and producer methods. Suppose I have<br>
> >the following bean:<br>
> ><br>
> >@ApplicationScoped<br>
> >public class Boop {<br>
> ><br>
> > @Produces<br>
> > @ApplicationScoped<br>
> > public Simpler makeSimpler() {<br>
> > return new Simpler("Boop");<br>
> > }<br>
> >}<br>
> ><br>
> >If I want to override the producer method, I need to declare fully:<br>
> ><br>
> >@Alternative<br>
> >@Priority(100)<br>
> >@ApplicationScoped<br>
> >public class BoopAlternative extends Boop{<br>
> > @Override<br>
> > @Produces<br>
> > public Simpler makeSimpler() {<br>
> > return new Simpler("Boop2");<br>
> > }<br>
> >}<br>
> ><br>
> >For some reason, scopes are inherited, but the produces annotation is not.<br>
> >At least in the case of a producer method, it seems like it would be<br>
> >useful for @Produces to be inherited as well.<br>
> ><br>
> >John<br>
> ><br>
> >________________________________<br>
> > NOTICE: This e-mail message and any attachments may contain confidential,<br>
> > proprietary, and/or privileged information which should be treated<br>
> > accordingly. If you are not the intended recipient, please notify the<br>
> > sender immediately by return e-mail, delete this message, and destroy all<br>
> > physical and electronic copies. Thank you.<br>
> > _______________________________________________<br>
> >cdi-dev mailing list<br>
> >cdi-dev@lists.jboss.org<br>
> ><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, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", 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, "Segoe UI", "Segoe WP", 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, "Segoe UI", "Segoe WP", 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>
> ><br>
> >Note that for all code provided on this list, the provider licenses the code<br>
> >under the Apache License, Version 2<br>
> >(<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>
> >provided on this list, the provider waives all patent and other<br>
> >intellectual property rights inherent in such information.<br>
> >cdi-dev Info Page - JBoss Developer<br>
> >lists.jboss.org<br>
> >List to discuss the development of CDI (the specification) To see the<br>
> >collection of prior postings to the list, visit the cdi-dev Archives.<br>
> ><br>
> ><br>
> >Unless stated otherwise above:<br>
> >IBM United Kingdom Limited - Registered in England and Wales with number<br>
> >741598.<br>
> >Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU<br>
> ><br>
> ><br>
> ><br>
> >________________________________<br>
> > NOTICE: This e-mail message and any attachments may contain confidential,<br>
> > proprietary, and/or privileged information which should be treated<br>
> > accordingly. If you are not the intended recipient, please notify the<br>
> > sender immediately by return e-mail, delete this message, and destroy all<br>
> > physical and electronic copies. Thank you.<br>
> ><br>
> >_______________________________________________<br>
> >cdi-dev mailing list<br>
> >cdi-dev@lists.jboss.org<br>
> ><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">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<br>
> >under the Apache License, Version 2<br>
> >(<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>
> >provided on this list, the provider waives all patent and other<br>
> >intellectual property rights inherent in such information.<br>
> ><br>
> ><br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> cdi-dev@lists.jboss.org<br>
> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">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<br>
> under the Apache License, Version 2<br>
> (<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>
> provided on this list, the provider waives all patent and other intellectual<br>
> property rights inherent in such information.<br>
> <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>