[weld-dev] @Inject FacesContext

Marcell Manfrin Barbacena barbacena at gmail.com
Tue Nov 10 17:26:37 EST 2009


4GS,

Make a Producer and move on! Want a mock? Make a Alternative Producer
and still move on!
Don't want to write? Use a available library.

IMHO the spec should be minimalist.

[]s

===
"Nobody knows who i really am
 I never felt this empty before
 And if I never need someone to come along
 Who's gonna comfort me and keep me strong?"
--
Marcell Manfrin Barbacena
barbacena at gmail.com
mbarbacena at tre-pb.gov.br
Skype: callto://marcell84bruk
+55 (83) 8808-8555 (Mobile)
+55 (83) 3224-5945 (Home)



On Tue, Nov 10, 2009 at 7:21 PM, Dan Allen <dan.j.allen at gmail.com> wrote:
>
>> The reason for injection is to be able to stub and unit test easily. Right
>> now the getCurrentInstance() is static and you'd need to use ugly
>> constructions to replace it with a stub (I am not saying it's impossible but
>> I am talking here from the feedback I've gathered and personal experience
>> when unit testing pure JSF).
>
> And the other, more subtle annoyance is the you have to eventually make that
> decision in a method when to create a local variable for FacesContext
> because your code is getting too verbose.
>
> FacesContext ctx = FacesContext.getCurrentInstance();
>
> I hate writing that line. Every time I do, I think to myself "I hate this
> stupid line of code."
>
> -Dan
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://www.google.com/profiles/dan.j.allen
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>



More information about the weld-dev mailing list