[cdi-dev] ServletContext Lifecycle and CDI Lifecycle Events

Pete Muir pmuir at redhat.com
Wed Oct 19 07:48:52 EDT 2011

Right, this is unspecified.

We would need to raise this issue with the Java EE group, as this group doesn't have control over ordering of Java EE component startup.

In CDI 1.1 we have introduced an event that is guaranteed to fire after all components have started, but before the application is put into service, which I think addresses your use case.

If however you actually want to use the ServletContext contextInitialized event in exactly the way you describe (to solve some other use case I'm not aware of ;-), then we would need to address the actual component start ordering. If this is the case, file a CDI tracking issue, and I can raise this with the Java EE group @ Oracle.


On 19 Oct 2011, at 07:46, Jens Schumann wrote:

> Hi All!
> While creating a simple CDI demo application I have been using a
> ServletContextListener to create test data in a database (using CDI and
> JPA). Works as expected. While doing so I have noticed that Glassfish
> 3.1.1 fires the ServletContext contextInitialized event way before my CDI
> AfterDeploymentValidation Extension was initialized. As far I understand
> this touches an unspecified area. However I would expect that the CDI
> runtime has to be initialized before issuing the context initialized event.
> What do you think?
> (The demo application is a simple .war application)
> Jens
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

More information about the cdi-dev mailing list