users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] Re: CDI injection in faces converters

From: Gerhard Petracek <gerhard.petracek_at_gmail.com>
Date: Wed, 16 Oct 2013 09:58:11 +0200

hi arjan,

in case of weld issues (like unsatisfied dependencies in an ear), it isn't
an issue jsf (or an add-on for it) can handle.
-> if you care about those cases, you can use a packaging trick or just
switch to owb (in my blog you can see what that means for weld based
servers).
(in addition everybody is welcome to help us to convince the cdi-eg.)

however, the correct handling of dependent-scoped converters and validators
is also quite important.
most implementations i've seen so far don't do the proper cleanup (as
specified for dependent-scoped beans).
what we have in myfaces-core is not 1:1 the same as in deltaspike.
however, both follow the same idea for a proper cleanup as well as for a
portable restore to ensure filled injection-points
(without the overhead we had in codi to support jsf 1.2).

regards,
gerhard



2013/10/15 arjan tijms <arjan.tijms_at_gmail.com>

> Hi Gerhard,
>
> Just wondering, did you test your implementation of injection into
> converters and validators with an EAR?
>
> When implementing this feature for OmniFaces, it appeared to be rather
> troublesome in EARs. As far as we could see the issues were attributed to
> the way the CDI spec and extensions work in combination with an EAR. See
> Bauke's blog for additional details:
> http://balusc.blogspot.com/2013/10/cdi-behaved-unexpectedly-in-ear-so.html
>
> Kind regards,
> Arjan
>
>
>
> On Tue, Oct 15, 2013 at 8:58 PM, Gerhard Petracek <
> gerhard.petracek_at_gmail.com> wrote:
>
>> hi arjan,
>>
>> fyi: the approach in myfaces-core and deltaspike doesn't have the
>> limitations which caused the deferral.
>> the only known restriction is that it isn't compatible with jsf 1.x.
>>
>> -> it will be our suggestion for jsf 2.3.
>>
>> regards,
>> gerhard
>>
>>
>>
>> 2013/10/15 arjan tijms <arjan.tijms_at_gmail.com>
>>
>>> Hi,
>>>
>>> It was indeed postponed in JSF 2.2 due to some last minute complication
>>> that was found.
>>>
>>> We have however implemented CDI injection for converters and validators
>>> in OmniFaces. See http://showcase.omnifaces.org/cdi/FacesConverter and
>>> http://showcase.omnifaces.org/cdi/FacesValidator
>>>
>>> Kind regards,
>>> Arjan Tijms
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Oct 15, 2013 at 1:28 PM, Gerhard Petracek <
>>> gerhard.petracek_at_gmail.com> wrote:
>>>
>>>> hi dirk,
>>>>
>>>> yes - it was postponed.
>>>> however, since i've committed it to apache myfaces-core (as an optional
>>>> feature)
>>>> as well as to apache deltaspike (-> you can also use it with mojarra),
>>>> it will be available soon.
>>>>
>>>> regards,
>>>> gerhard
>>>>
>>>>
>>>>
>>>> 2013/9/8 Dirk Weil <dirk.weil_at_gedoplan.de>
>>>>
>>>>> Are CDI injections supported in JSF 2.2 converters and validators?****
>>>>>
>>>>> ** **
>>>>>
>>>>> I thought they were, but at least injections in
>>>>> @FacesConverter(forClass = xxx.class) annotated converters are not executed
>>>>> on GLF 4.0.1 (Mojarra 2.2.2). Now I found some forum entries saying
>>>>> injections didn’t make it into JSF 2.2. What is correct?****
>>>>>
>>>>> ** **
>>>>>
>>>>> Thanks for any clarification!****
>>>>>
>>>>> Dirk****
>>>>>
>>>>
>>>>
>>>
>>
>