这似乎不起作用:
@Inject
private MyBBean<OtherBBean> myBean;
是否可行或尝试这样做是错误的? 我收到这个错误:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MyBBean<OtherBBean>] with qualifiers [@Default] at injection point [[field] @Inject private com.my.project.beans.jsf.BreakBBean.myBBean]
编辑: 添加更多信息:
@Named(value="org")
@SessionScoped
public class OrgBBean extends MainViewBase<Org> implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private OtherBBean otherBBean;
}
@Named
@Dependent
public class OtherBBean extends OrgTabMemberBBean<Other> implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private MyBBean<OtherBBean> myBBean;
}
@Named
@Dependent
public class MyBBean <O extends EditableBase<? extends BaseEntity>> extends EditableTabListBBean<My, O> implements Serializable {
private static final long serialVersionUID = 1L;
}
答案 0 :(得分:0)
在这里测试并且工作正常。你是不是错过了什么,比如忘记在MyBBean类中添加@Named
,或者在@SessionScoped
bean中使用它,而MyBBean没有实现Serializable?
编辑:您可以发布MyBBean代码吗?
答案 1 :(得分:0)
我只使用原始类型来解决这个问题。它有效,但现在我必须小心使用它。
@Inject
private MyBBean myBBean;