我有一个bean,我最近从一个托管bean转换成了一个spring-bean。将FacesContext注入Spring bean
一切顺利,直到在某个点以下的方法被称为:
Exception e = (Exception) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(
AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY);
在这一点上的东西炸掉,因为FacesContext.getCurrentInstance()
返回null。
是有可能注入faces上下文到我的豆?
只是作为背景:如果`FacesContext.getCurrentInstance()`返回null,则该呼叫可能被JSF生命周期外进行(之前上下文已经被初始化,在它被销毁之后或者在不同的线程中)。 `FacesContext`实例的每个请求范围都保存在一个`ThreadLocal`变量中。 – McDowell 2010-12-23 14:14:22