关于将spring bean注入jsf bean的问题

将spring bean注入jsf bean时遇到问题,导致javax.faces.FacesException(无法实例化类),javax.faces.el.E​​valuationException

这是我的xml文件:

文件WEB-INF / components.xml定义了spring bean

     

文件WEB-INF / faces-config.xml定义了jsf bean

  Video Home Bean videoBean rambo.tool.VideoBean session  videoService videoService #{Components["rambo.api.VideoService"]}    

文件videoMain.jsp:

在resourceToolExists中:videoBean使用videoService的一些方法

    

得到:javax.faces.FacesException(无法实例化类rambo.impl.VideoServiceImpl),javax.faces.el.E​​valuationException

您需要在faces-config.xml文件中配置spring elresolver。 spring elresolver将评估你的el express并获取spring中定义的bean对象请查看http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/jsf/el/SpringBeanFacesELResolver。 HTML