I use Spring, Hibernate and JSF.
To get a bean from the application context, I write:
public static Object findBean(String name) {
return FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()).getBean(name);
}
However, it FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance())returns null, so calling getBean()on it callsNullPointerException
Does anything need to be defined somewhere?
EDITED
I need to get bean from application context, not jsf bean
source
share