The CDI spec is unfortunately rather vague on availability of beans during creation.
Yep. The spec only mentions that impls are allowed to push incomplete instances into the CreationalContext and use them to attempt to solve circular dependencies. See also http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#creational_context. I think we can try a similar approach for observers but this would mean that the observer method (TestController.onEvent() from your example) will be invoked on an incomplete instance. It should work in most cases but it's not something I would recommend to do... |