我正在尝试在超类中注入一个 bean,如下所示:
public class DsmCrudDaoProcuder
{
@Produces
public static DsmCrudDao produceDao(InjectionPoint injectionPoint) {
return ((CRUDSessionBase)injectionPoint.getBean()).createCrudDao();
}
}
public abstract class CRUDSessionBase{
@Resource public SessionContext context;
protected static Log log = LogFactory.getLog(CRUDSessionBase.class.getName());
protected static Log logger = LogFactory.getLog(CRUDSessionBase.class.getName());
@Inject @New
DsmCrudDao dao;
/**
* Get the concrete DAO
*
* @return
*/
protected abstract DsmCrudDao createCrudDao();
....
}
这在部署时失败:
WELD-001409 在注入点 [[field] @Inject com.windriver.dsm.ejb.CRUDSessionBase.dao] 具有限定符 [@Default] 的类型 [DsmCrudDao] 的不明确依赖项。可能的依赖项 [[Managed Bean [class com.windriver.dsm.labmanagement.dao.TECodeCoverageDao] 带有限定符 [@Any @Default],Managed Bean [class com.windriver.dsm.enterprise.dao.BinaryGroupDao] 带有限定符 [@Any @Default]、Managed Bean [class com.windriver.dsm.labmanagement.dao.TeBlockCoverageDao] 带限定符 [@Any @Default]、Managed Bean [class com.windriver.dsm.enterprise.dao.DeviceSupportedServiceDao] 带限定符 [@Any @默认], ....
错误列表中的所有 bean 都是DsmCrudDao
.
有没有办法使这项工作?