0

这似乎不起作用:

@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;
}
4

2 回答 2

0

在这里测试并且工作正常。您是否错过了一些事情,例如忘记添加@NamedMyBBean 类,或者可能在@SessionScopedbean 中使用它而 MyBBean 没有实现 Serializable?

编辑:您可以发布您的 MyBBean 代码吗?

于 2012-05-22T14:38:18.043 回答
0

我只使用原始类型来解决这个问题。它有效,但现在我必须小心我如何使用它。

@Inject
private MyBBean myBBean;
于 2012-05-24T10:47:14.863 回答