
Untitled
By: a guest on
Jul 15th, 2012 | syntax:
None | size: 0.88 KB | hits: 12 | expires: Never
@PostConstruct not working in @FacesValidator
@ManagedProperty(value = "#{jndiServiceLocatorBean}")
private final JndiServiceLocatorBean jndiServiceLocatorBean = null;
private UserBeanRemote userBeanRemote = null;
@PostConstruct
public void postConstruct()
{
this.userBeanRemote = (UserBeanRemote) this.jndiServiceLocatorBean.getRemoteBean(UserBeanRemote.class);
}
@FacesValidator("fooValidator")
public class FooValidator implements Validator {
private UserBeanRemote userBeanRemote;
public FooValidator() {
FacesContext context = FacesContext.getCurrentInstance();
JndiServiceLocatorBean jndiServiceLocatorBean = context.getApplication().evaluateExpressionGet(context, "#{jndiServiceLocatorBean}", JndiServiceLocatorBean.class);
this.userBeanRemote = (UserBeanRemote) jndiServiceLocatorBean.getRemoteBean(UserBeanRemote.class);
}
// ...
}