jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [527-InjectFacesContext] Support and review

From: Arjan Tijms <arjan.tijms_at_zeef.com>
Date: Wed, 24 Sep 2014 18:29:47 +0200

Hi,

On Wed, Sep 24, 2014 at 4:12 PM, manfred riem <manfred.riem_at_oracle.com> wrote:
> As part of ramping up for the JSF 2.3 spec cycle I went ahead and prototyped
> @Inject support for the FacesContext and it works, but as I want to be fair
> to the spec process I am asking you if we should support this?

Definitely support this. Having important artefacts injectable
certainly plays well with the theme of aligning with CDI.

One issue though is that injection now only works in request scoped
beans, since FacesContext is not normal scoped itself. While
understandable from a technical point of view, I wonder whether or not
it's possible to inject a bean instead so CDI will use a proxy and
injection can be safely done in any type of bean.

Looking at some other work, the CDI 1.1 spec allows one to inject an
HttpServletRequest, but it's also dependent scoped. Seam 3 however
allowed injection of a ServletRequest as a request scoped bean, which
could therefore be safely injected everywhere.

Something to think about perhaps.

Kind regards,
Arjan Tijms