When an application is initialized, Weld fires an event at each stage of the container lifecycle that allows extensions to integrate with the initialization process of Weld.
The container lifecycle consists of the following event sequence:
The
BeforeBeanDiscovery
event is fired before Weld begins the process of discovering beans within our application. This event allows us to add scopes, annotated types, qualifiers, stereotypes, and interceptor bindings to our application. Adding an annotated type is the most powerful, as this allows us to take a class that would not be a bean and make it a bean within our application.The
AfterBeanDiscovery
event is fired by Weld when it has fully completed the bean discovery process and verified that there are no definition errors with the beans that were discovered within our application. Our extension can observe this event to add new beans, observer methods, or context.The
AfterDeploymentValidation
event is fired by...