<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sorry, should go to reply-all.<div class=""><br class=""></div><div class="">LieGrue,</div><div class="">strub<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Anfang der weitergeleiteten Nachricht:</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Von: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Mark Struberg &lt;<a href="mailto:struberg@yahoo.de" class="">struberg@yahoo.de</a>&gt;<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Betreff: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Aw: [cdi-dev] Extensions and spec-related observer method injection points question</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Datum: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">19. Februar 2017 um 21:05:30 MEZ<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">An: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Matej Novotny &lt;<a href="mailto:manovotn@redhat.com" class="">manovotn@redhat.com</a>&gt;<br class=""></span></div><br class=""><div class=""><div class=""><blockquote type="cite" class=""><br class="">While you cannot do this, you can still get hold of BeanManager and use it to resolve your bean.<br class=""></blockquote><br class="">No, you cannot. At least not before AfterBeanValidation.<br class=""><br class="">LieGrue,<br class="">strub<br class=""><br class=""><br class=""><blockquote type="cite" class="">Am 17.02.2017 um 07:08 schrieb Matej Novotny &lt;<a href="mailto:manovotn@redhat.com" class="">manovotn@redhat.com</a>&gt;:<br class=""><br class="">Hi, comment inline.<br class=""><br class="">----- Original Message -----<br class=""><blockquote type="cite" class="">From: "Laird Nelson" &lt;<a href="mailto:ljnelson@gmail.com" class="">ljnelson@gmail.com</a>&gt;<br class="">To: <a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">Sent: Thursday, February 16, 2017 11:11:41 PM<br class="">Subject: [cdi-dev] Extensions and spec-related observer method injection<span class="Apple-tab-span" style="white-space:pre">        </span>points question<br class=""><br class="">This section (<br class=""><a href="http://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#init_events" class="">http://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#init_events</a> ) says: "If<br class="">other beans [other than the BeanManager ] are injected into an [portable]<br class="">extension’s observer methods, non-portable behavior results."<br class=""><br class="">Rephrased: a portable extension's observer methods must have a minimum of one<br class="">parameter (the event being observed) and a maximum of two parameters (that<br class="">plus the BeanManager ), and none other if you want to stay truly portable.<br class=""></blockquote><br class="">That's correct interpretation.<br class=""><br class=""><blockquote type="cite" class="">For true container lifecycle events, I understand this (you don't have beans<br class="">to inject yet). But given that a bean must be provided by the container for<br class="">a portable extension (<br class=""><a href="http://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#init_events" class="">http://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#init_events</a> ), wouldn't<br class="">it be reasonable to permit extra injection points in a portable extension's<br class="">non -container-lifecycle-event-observing observer methods?<br class=""><br class="">Concretely, I'd like to do this:<br class=""><br class="">// In my portable extension<br class="">private static final void doSomethingAtStartup(@Observes<br class="">@Initialized(ApplicationScoped.class) final Object event, final Frobnicator<br class="">someBean) {<br class="">someBean.doSomething();<br class="">}<br class=""></blockquote><br class="">While you cannot do this, you can still get hold of BeanManager and use it to resolve your bean.<br class=""><br class=""><blockquote type="cite" class=""><br class="">...but that would seem to be in violation of the specification. Could someone<br class="">kindly explain why?<br class=""></blockquote><br class="">Not really sure, perhaps Martin or Antoine can share the details.<br class="">But I would say this could create quite some confusion if in some observer you could inject certain beans and in others you couldn't.<br class="">Even in your sample, you can only inject AppScoped beans, so imagine you do such observer for, say, SessionScoped, what can you inject there?<br class="">SessionScoped for sure, how about Req? Conversation?<br class=""><br class=""><blockquote type="cite" class=""><br class="">Thanks,<br class="">Best,<br class="">Laird<br class=""><br class="">_______________________________________________<br class="">cdi-dev mailing list<br class=""><a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">https://lists.jboss.org/mailman/listinfo/cdi-dev<br class=""><br class="">Note that for all code provided on this list, the provider licenses the code<br class="">under the Apache License, Version 2<br class="">(http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas<br class="">provided on this list, the provider waives all patent and other intellectual<br class="">property rights inherent in such information.<br class=""></blockquote><br class="">_______________________________________________<br class="">cdi-dev mailing list<br class=""><a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">https://lists.jboss.org/mailman/listinfo/cdi-dev<br class=""><br class="">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.<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>