I am using Spring, Hibernate and JSF.
In order to get a bean from application context I write:
public static Object findBean(String name) {
return FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()).getBean(name);
}
However, the FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance())
returns null, so calling getBean()
on it throws NullPointerException
Do I need to define anything anywhere?
EDITED
I need to get the bean from application context and not jsf bean