Hi
The problem is we introduce a dependency in CDI for JSF, unless we get
the facesContext through reflection. It is a "chicken-egg" problem. It
also create a problem with previous versions of CDI, because those
versions does handle FacesContext, so in JSF we need to introduce code
to handle that, and that's not good.
There is no real advantage to do that. As far as I remember, CDI is an
optional dependency, even if there are classes in JSF that use CDI
api, you can run JSF without CDI. Does that will change with JSF 2.3?
The implementation we have to resolve #{facesContext} in MyFaces has
some improvements to avoid call FacesContext.getCurrentInstance(),
which at the end reduce the time spent evaluating EL expressions. If
we move that to CDI, we lose that too.
I think CDI provides a pluggable API that works for our needs. The
only thing that I miss about that API is that you can't control class
scanning, and that causes problems because application servers
sometimes need to customize that part.
regards,
Leonardo Uribe
2014-10-06 11:08 GMT-05:00 manfred riem <manfred.riem_at_oracle.com>:
> Hi all,
>
> To add a little bit of information, as part of writing the @Inject support
> it is also makes it possible to support #{facesContext} with minimal effort.
> From a code perspective to have everything route through the same CDI
> producer seems to make sense to me.
>
> Obviously once we decide to do this with FacesContext more JSF artifacts
> could easily follow the same route. But to keep the discussion focused I
> just want to concentrate on FacesContext first.
>
> Thanks,
> Manfred
>
>
> On 10/6/14, 10:43 AM, arjan tijms wrote:
>>
>> Hi,
>>
>> On Mon, Oct 6, 2014 at 5:20 PM, manfred riem<manfred.riem_at_oracle.com>
>> wrote:
>>>
>>> As part of the CDI alignment I think it is entirely feasible to have the
>>> CDI
>>> runtime handle the EL resolving of #{facesContext}.
>>
>> As some background; it's currently handled (at least in Mojarra) by a
>> custom EL resolver; com.sun.faces.el.ImplicitObjectELResolver
>>
>> The question would thus boil down to ELResolver vs CDI @Named (or
>> extension equivalent). Haven't looked into the issue in depth, but
>> things to consider might be the possibility to override the name or
>> not and whether some order for resolving changes.
>>
>> Kind regards,
>> Arjan