Search code examples
cdijboss-weldweld

Weld Circular Dependency of normal scoped beans


I'm using JBoss EAP 6.4 (and Weld 1.1.28) and trying to get rid of Seam 2. One part of that is switching over to CDI. I get the following (anonymized) error:

org.jboss.weld.exceptions.DeploymentException: WELD-001443 Pseudo scoped bean
has circular dependencies. Dependency path
[Managed Bean [A] with qualifiers [@Default @Any @Named],
 Managed Bean [B] with qualifiers [@Default @Any],
 Managed Bean [C] with qualifiers [@Default @Any],
 Managed Bean [D] with qualifiers [@Default @Any],
 Managed Bean [C] with qualifiers [@Default @Any]]

Every single one of these is @SessionScoped, however, so it seems like this should work since @SessionScoped is a "normal" scope. Why doesn't this work?


Solution

  • @SessionScoped for CDI is javax.enterprise.context.SessionScoped. If you happen to annotate class with javax.faces.bean.SessionScoped then your class is not managed by CDI. When you try to @Inject it then it will be @Dependent pseudo-scoped.