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

[jsr372-experts] Re: [1311-FacesContextCDI] Let CDI handle #{facesContext}

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Tue, 7 Oct 2014 22:34:34 +0200

On Tue, Oct 7, 2014 at 8:23 PM, John Yeary <johnyeary_at_gmail.com> wrote:

> This is quite a discussion around CDI injection of the FacesContext. I see
> the merits of using CDI and for one of my projects we were using CDI with
> Mojarra. Everything was working well until we had to use WebSphere. The IBM
> implementation of CDI + JSF was OpenWebBeans and MyFaces. We could use
> Mojarra, but without CDI. If we wanted to use CDI we would have to use
> MyFaces.
>

Because of the container specific SPI that needs to be implemented for JSF
to integrate well with some container services, swapping out JSF at the
container level for an implementation from a different vendor is never
trivial. WebSphere is particularly difficult as even upgrading to a newer
MyFaces version isn't possible without losing this support (my guess is
that may have modified the MyFaces implementation itself instead of
implementing the SPI separately).

It's a different discussion, but maybe we could look for JSF 2.3 to
standardize and/or simplify the SPI requirements? I'm not 100% up to date
with how the SPI exactly works, but the Mojarra and MyFaces guys can
probably comment on this.



> We had written a number of components taking advantage of Mojarra. We
> didn't want to have to have multiple implementations of our components for
> Mojarra and MyFaces.
>

Just curious, but why were the components specifically tied to Mojarra?



> 1. How do we deal with different CDI implementations? Is there going to be
> a requirement that the CDI implementations must work with Mojarra, as well
> as, MyFaces?
>

As Manfred explained as well, there should not really be a need for an
explicit requirement for this. JSF implementations should of course only
use public CDI APIs (APIs that are defined by the CDI specification) and
naturally not rely on anything that's specific for a given CDI
implementation.

But this is not really different from how things are today. JSF is already
using other specs like BeanValidation, and since only public APIs are used
any implementation of JSF works with any implementation of BeanValidation
given that both have passed the TCK.

Kind regards,
Arjan Tijms