0

We use FacesConverters and annotate them with CODI's @Advanced annotation in order to be able to use CDI injection. This works with normal requests. But on AJAX requests the injected CDI beans are null. And the FacesContext parameter in

public Object getAsObject(FacesContext context, UIComponent component, String value)

is org.apache.myfaces.context.servlet.FacesContextImpl instead of org.apache.myfaces.extensions.cdi.jsf2.impl.listener.request.CodiFacesContextWrapper as it is on normal requests when injection works.

Does anyone know how to make injection work in FacesConverters with AJAX requests? Thanks.

Julia
  • 318
  • 1
  • 5
  • 14
  • Are you using MyFaces-Core or Mojarra as an JSF implementation? – Dar Whi Nov 13 '12 at 14:36
  • Interesting. You said that it works for non-AJAX, but in my app (I'm recently migrating to CDI from JSF managed beans), @Advanced with FacesConverter(forClass=...) is not injecting the bean on non-AJAX. – Howard Nov 19 '12 at 23:56
  • FYI, see the following: http://stackoverflow.com/a/13156834/933054; that answer lead me to add JSF (RequestScoped) Managed Beans that only contain @FacesConverter and Converter. I tested it, and it works as I am migrating from JSF managed beans to CDI managed beans. – Howard Nov 20 '12 at 03:44

0 Answers0