I've a pretty basic setup here:
@Named
@ApplicationScoped
public class TalentIdConverter implements Converter {
@EJB
private EntityManagerDao em;
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (Strings.isNullOrEmpty(value)) {
return null;
}
return em.find(Talent.class, Long.parseLong(value));
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
return String.valueOf(((Talent) value).getId());
}
}
// Manager.class
public class Manager {
@Inject @Param(converterClass = TalentIdConverter.class, name = "talentId")
private ParamValue<Talent> curTalent
@PostConstruct
public void init() {
// use curTalent.getValue()
}
}
But every time TalentIdConverter.getAsObject
is called em
is null. Can someone enlighten me why this is?
I've also tried using @FacesConverter
on the converter, but the behavior did not change.
This is on Wildfly-8.0.0.Beta1 using Weld-2.1.0.CR1 and Omnifaces-1.6.3