I've actually had this exact same dilemma in Seam. I want to know when everything is ready. So it really depends on how you define after (or started)

If you want to know when CDI is done starting up and when application-scoped beans are available, that's the AfterDeploymentValidation event. However, I also believe that this sounds too ambiguous. You have to know that deployment validation is the last phase to know that the CDI beans are ready.

Then there is the question of "when is the module deployed?" (module meaning web archive, for instance). It amazes me that there is no definitive event in Java EE for this. I've hacked around this in Seam by registering a Servlet with a very low priority and fire an event in the init() method.


I consider that a design requirement for EE 7.


On Fri, Jan 14, 2011 at 16:09, Mark Struberg <struberg@yahoo.de> wrote:

I need to trigger a task once the whole CDI container got started, and I'm not sure  if the AfterDeploymentValidation can be used for this. Basically what I like to do is to warm-up & initialise CDI based services when the server has been started.

The AfterDeploymentValidation system event is defined as:

"The container must fire a third event after it has validated that there are no deployment problems and before creating contexts or processing requests."

Thus especially the part "before creating contexts" is a bit unclear. Does this mean that no @ApplicationScoped, etc beans are available yet in this phase?

If so, do we like to introduce a new AfterServerStart event?


weld-dev mailing list

Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597