CDI VooDoo – The Bean Manager and Circular Injection

CDI supports circular dependency injection when at least one of the beans has a normal scope*, this may be useful when sharing contextual information between beans of same or different scope (e.g. MVC pattern).

The CDI BeanManager is responsible for the creation of all CDI beans and managing contextual access to all normal scoped beans.

@RequestScoped
public class Foo {
   @Inject
   private Bar bar;
   ...
}

@RequestScoped
public class Bar {
   @Inject
   private Foo foo;
   ...
}

Continue reading CDI VooDoo – The Bean Manager and Circular Injection