[seam-dev] @Current DependentType or Manager.getInstanceByType

Dan Allen dan.j.allen at gmail.com
Mon Apr 27 14:00:43 EDT 2009


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)?

@Current Expressions expressions;

or

@Current Manager manager
...
manager.getInstanceByType(Expressions.class)

(bindings may exist too)

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.

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.

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20090427/9fc58a7f/attachment.html 


More information about the seam-dev mailing list