[cdi-dev] AfterBeanDiscovery in the light of CDI-392

Jozef Hartinger jharting at redhat.com
Wed Apr 16 09:17:06 EDT 2014

Queuing ABD operations and applying them once all ABD observers are 
finished was part of the solution for CDI-392 however it seems that this 
part is not reflected within the specification :-/

On 04/16/2014 01:08 PM, Martin Kouba wrote:
> Hi all,
> I see an inconsistency between the resolution of CDI-392 and the current
> wording of "11.5.3. AfterBeanDiscovery event".
> addBean(): "Fires an event of type ProcessBean containing the given Bean
> and then registers the Bean with the container, thereby making it
> available for injection into other beans. The given Bean may implement
> Interceptor or Decorator."
> On the other hand BeanManager.getBeans() javadoc:
> "Note that when called during invocation of an AfterBeanDiscovery event
> observer, this method will only return beans discovered by the container
> before the AfterBeanDiscovery event is fired."
> It seems ProcessBean should be fired and the bean should be registred
> when addBean() is called BUT in the same time it should not be available
> via BeanManager.getBeans() until all AfterBeanDiscovery observers are
> processed.
> The same applies to observer methods.
> Weld 2.2.0.Final delays the ProcessBean/registration until all
> AfterBeanDiscovery observers are processed (note that it's not backwards
> compatible). I believe this is correct. If so, the AfterBeanDiscovery
> event description should be clarified. Otherwise the RI must be changed
> (and I'm afraid it wouldn't be that trivial).

More information about the cdi-dev mailing list