[ 
https://issues.apache.org/jira/browse/EXTCDI-127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986580#action_12986580
 ] 

Jakob Korherr commented on EXTCDI-127:
--------------------------------------

The problem is that the <h:selectOneMenu /> component (like any input or output 
component) tries to save the converter in its state (see UIOutput.saveState() 
on line 199 in MyFaces core 2.0.3). However, for a normal (non-serializable) 
converter only the Class of the converter is saved in the state. Later, on the 
next request, the state is restored and the converter is created via 
converterClass.newInstance(). Unfortunately this "custom" converter instance is 
used to process the data and thus you get an instance of your converter without 
CDI injection.

For CODI it seems like we have to do some custom state saving of @Advanced 
converters...

> Injection in FacesConverter does not work
> -----------------------------------------
>
>                 Key: EXTCDI-127
>                 URL: https://issues.apache.org/jira/browse/EXTCDI-127
>             Project: MyFaces CODI
>          Issue Type: Bug
>          Components: JEE-JSF20-Module
>    Affects Versions: 0.9.2
>         Environment: Myfaces 2.0.3, CODI 0.9.2, ExtVal 2.0.4, OWB 1.0.0, 
> PrimeFaces 2.2-RC2
>            Reporter: Thomas Andraschko
>            Assignee: Jakob Korherr
>
> The bean which sould be injected in my converter is always null.
> I also added some logging to CODI, to see where the problem is.
> The bean was created and injected into the converter but it seems as the used 
> converter is not the converter which was created by CODI.
> Is there something wrong in my setup or is this really a bug?
> -----------------------------------------------------------
> @Advanced
> @FacesConverter("localeConverter")
> public class LocaleConverter implements Converter {
> @Inject       private LocaleService localeService;
> -----------------------------------------------------------
> <h:form>
>       <h:selectOneMenu 
>               id="selectLocaleMenu" 
>               value="#{localeController.selectedLocale}"
>               onchange="this.form.submit()" 
>               converter="localeConverter">
>               <f:selectItems 
>                       value="#{allLocalesController.locales}" 
>                       var="locale" 
>                       itemLabel="#{locale.name}" 
>                       itemValue="#{locale}"/>
>       </h:selectOneMenu>
> </h:form>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to