我正在做一个没有xml的java项目。我如何翻译
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
XML文件的行?
我尝试创建一个看起来像这样的类,但不知道要调用的是谁或者什么:
package com.journaldev.configWeb;
import javax.el.ELContext;
import javax.faces.context.FacesContext;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.access.el.SpringBeanELResolver;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;
public class SpringBeanFacesELResolver extends SpringBeanELResolver {
@Override
protected BeanFactory getBeanFactory(ELContext elContext) {
return getWebApplicationContext(elContext);
}
protected WebApplicationContext getWebApplicationContext(ELContext elContext) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return FacesContextUtils.getRequiredWebApplicationContext(facesContext);
}
}