[weld-dev] @Inject FacesContext

Siarhei Dudzin siarhei.dudzin at gmail.com
Tue Nov 10 16:30:07 EST 2009


Hi,

I don't post much here but I felt obliged to comment on this thread.

I have to agree with Dan. This probably will one of the most used
injections.

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). Note, I am talking about 'true' unit testing
with no container involved.
If faces context will be injectable it will make many people happy :)

Just my 2 cents...

Best regards,
Siarhei Dudzin


On Tue, Nov 10, 2009 at 10:07 PM, Gavin King <gavin.king at gmail.com> wrote:

> Why do you want to access them directly? Surely that's what we're
> trying to get away from?
>
> On Tue, Nov 10, 2009 at 4:02 PM, Nicklas Karlsson <nickarls at gmail.com>
> wrote:
> > ...and the HTTP session and request. Probably something most
> > frameworks will provide if nothing else.
> >
> > On Tue, Nov 10, 2009 at 10:50 PM, Dan Allen <dan.j.allen at gmail.com>
> wrote:
> >> Is the following injection going to be supported in Java EE 6?
> >>
> >> @Inject FacesContext ctx;
> >>
> >> Because I can't even begin to count how many times I'm going to need
> that
> >> when developing apps. Probably the #1 injection in JSF apps.
> >>
> >> (True, I could make a producer method myself, but so will the n-thousand
> >> other JSF developers).
> >>
> >> -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
> >>
> >
> >
> >
> > --
> > ---
> > Nik
> > _______________________________________________
> > weld-dev mailing list
> > weld-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/weld-dev
> >
>
>
>
> --
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20091110/22538ec1/attachment-0001.html 


More information about the weld-dev mailing list