我正在尝试将一个EJB无状态bean注入到servlet Filter中,但是servlet会抛出一个NullPointerExcetion,其错误如下:
Dependency injection failure: can't find the bean definition about
class interface com.bofa.gcib.ccp.customer.ejb.remote.AuditRemote;
nested exception is
com.bea.core.repackaged.springframework.beans.factory.
NoSuchBeanDefinitionException:
No unique bean of type
AuditRemote是一个由AuditEJB实现的接口。
@Remote(AuditRemote.class)
@Stateless(name = "AuditEJB", mappedName = "AuditEJB", description = "Audit Bean")
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class AuditEJB implements AuditRemote {
}
尝试将此EJB注入Servlet过滤器,如下所示。
@Stateless
public class CustomFilter implements Filter {
@EJB(mappedName = "AuditEJB")
private AuditEJB auditEJB;
}