[cdi-dev] Application lifecycle events

Pete Muir pmuir at bleepbleep.org.uk
Tue Sep 6 08:05:58 EDT 2011


I've created a pull request for https://issues.jboss.org/browse/CDI-86 at https://github.com/jboss/cdi/pull/39.

This adds these events:

		• @Initialized @Application Object o;
		• @Destroyed @Application Object o;
		• @Initialized @Session Object o;
		• @Destroyed @Session Object o;
		• @Initialized @Conversation Object o;
		• @Destroyed @Conversation Object o;
		• @Initialized @Request Object o;
		• @Destroyed @Request Object o;

The actual event type depends on why the context was initialized (e.g. if it's a web app you would normally see the relevant servlet event objects). More details in the pull

There are a few open issues on which I appreciate feedback:

* The CDI 1.0 spec doesn't define when a context is "initialized" (however the concept is implied), however the CDI spec introduces lifecycle events that require an event to be fired when a context is initialized. Either we need to rewrite the definition of this feature to use the CDI 1.0 language or we need to define when a context is initialized.
* What should the event type be for requests initialized due to an EJB remote invocation and a JMS MessageListener invocation?
* What should the event type be for applications initialized or destroyed when the application is not a web app?
* The annotations for context lifecycle events are in the new package javax.enterprise.context.lifecycle. Should they be placed elsewhere (especially if we envision them being used for other purposes than context lifecycle events?)


More information about the cdi-dev mailing list