In the development of Seam 3, when we need a reference to another component, which of the following should we be using (in general practice, not necessarily exclusively)?<br><br>@Current Expressions expressions;<br><br>or<br>
<br>@Current Manager manager<br>...<br>manager.getInstanceByType(Expressions.class)<br><br>(bindings may exist too)<br><br>The heavy use of statics in Seam made it a huge pain to setup for unit/multi-unit testing. It's a toss up for me w/ Seam 3 because while it is easy to inject a mock Expressions in a pure unit test (no Web Beans manager), it is arguably just as easy to inject a @Mock MockExpressions with the thin @Artifact test framework. I still like the idea of being able to go w/o the manager though.<br>
<br>As a follow up question, when we do an injection, should it be private, package, or protected. Package seems to make the most sense now that it is easy for us to put tests in the same package. Private seems like a bad choice to me...with protected maybe a bit too exposed.<br>
<br>-Dan<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'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't hesitate to resend a message if<br>
you feel that it did not reach my attention.<br>