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

Gavin King gavin.king at gmail.com
Tue Apr 28 16:17:25 EDT 2009


I don't see a good reason to avoid the use of injection with the web
beans core, since it doesn't have the same performance implications.
Anyway, we could hardcode optimizations for commonly used types...

On Mon, Apr 27, 2009 at 1:00 PM, Dan Allen <dan.j.allen at gmail.com> wrote:
> 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.
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org




More information about the seam-dev mailing list