I figured there would be no problem using field injection since one of the big accomplishments of 299 was to make that service extremely efficient. I&#39;m just thinking that we should leverage other types of injection where appropriate, perhaps making the judgment call at the time. For instance, if a bean uses one other dependency, and it always needs that dependency, then I think it should be provided through an @Initializer constructor. I see field injection more as a &quot;I need it sometimes, but not always and maybe never&quot; case. Then of course there are producer methods and the like that could avoid the field injection if the dependency pertains only to that method.<br>
<br>...so in short, I think we should choose wisely rather than always opting for field injection....and we should avoid as much as possible direct lookups to the Manager inside of a method...because it makes the class more difficult to unit test.<br>
<br>Btw, testing Web Beans so far is just dreamy. I get excited just to write tests again ;)<br><br>-Dan<br><br><div class="gmail_quote">On Tue, Apr 28, 2009 at 4:17 PM, Gavin King <span dir="ltr">&lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I don&#39;t see a good reason to avoid the use of injection with the web<br>
beans core, since it doesn&#39;t have the same performance implications.<br>
Anyway, we could hardcode optimizations for commonly used types...<br>
<div><div></div><div class="h5"><br>
On Mon, Apr 27, 2009 at 1:00 PM, Dan Allen &lt;<a href="mailto:dan.j.allen@gmail.com">dan.j.allen@gmail.com</a>&gt; wrote:<br>
&gt; In the development of Seam 3, when we need a reference to another component,<br>
&gt; which of the following should we be using (in general practice, not<br>
&gt; necessarily exclusively)?<br>
&gt;<br>
&gt; @Current Expressions expressions;<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; @Current Manager manager<br>
&gt; ...<br>
&gt; manager.getInstanceByType(Expressions.class)<br>
&gt;<br>
&gt; (bindings may exist too)<br>
&gt;<br>
&gt; The heavy use of statics in Seam made it a huge pain to setup for<br>
&gt; unit/multi-unit testing. It&#39;s a toss up for me w/ Seam 3 because while it is<br>
&gt; easy to inject a mock Expressions in a pure unit test (no Web Beans<br>
&gt; manager), it is arguably just as easy to inject a @Mock MockExpressions with<br>
&gt; the thin @Artifact test framework. I still like the idea of being able to go<br>
&gt; w/o the manager though.<br>
&gt;<br>
&gt; As a follow up question, when we do an injection, should it be private,<br>
&gt; package, or protected. Package seems to make the most sense now that it is<br>
&gt; easy for us to put tests in the same package. Private seems like a bad<br>
&gt; choice to me...with protected maybe a bit too exposed.<br>
&gt;<br>
&gt; -Dan<br>
&gt;<br>
&gt; --<br>
&gt; Dan Allen<br>
&gt; Senior Software Engineer, Red Hat | Author of Seam in Action<br>
&gt;<br>
&gt; <a href="http://mojavelinux.com" target="_blank">http://mojavelinux.com</a><br>
&gt; <a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br>
&gt; <a href="http://in.relation.to/Bloggers/Dan" target="_blank">http://in.relation.to/Bloggers/Dan</a><br>
&gt;<br>
&gt; NOTE: While I make a strong effort to keep up with my email on a daily<br>
&gt; basis, personal or other work matters can sometimes keep me away<br>
&gt; from my email. If you contact me, but don&#39;t hear back for more than a week,<br>
&gt; it is very likely that I am excessively backlogged or the message was<br>
&gt; caught in the spam filters.  Please don&#39;t hesitate to resend a message if<br>
&gt; you feel that it did not reach my attention.<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; seam-dev mailing list<br>
<div class="im">&gt; <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
</div>&gt; <a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Gavin King<br>
<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
<a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
<a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
<a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Dan Allen<br>Senior Software Engineer, Red Hat | Author of Seam in Action<br><br><a href="http://mojavelinux.com">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction">http://mojavelinux.com/seaminaction</a><br>
<a href="http://in.relation.to/Bloggers/Dan">http://in.relation.to/Bloggers/Dan</a><br><br>NOTE: While I make a strong effort to keep up with my email on a daily<br>basis, personal or other work matters can sometimes keep me away<br>
from my email. If you contact me, but don&#39;t hear back for more than a week,<br>it is very likely that I am excessively backlogged or the message was<br>caught in the spam filters.  Please don&#39;t hesitate to resend a message if<br>
you feel that it did not reach my attention.<br>