Startup beans architecture

Basically, startup beans are user-defined session EJBs. Except for running before an application starts, they do not differ from other kinds of session EJBs. A startup bean can be either stateful or stateless. If it is stateful, the startup service use the same instance for starting and stopping the application. If it is stateless, the startup service use one instance of the startup bean for starting the application, and a different instance for stopping it.

A startup bean usually has a start() method, a stop() method, and an optional environment property called wasStartupPriority.

For an application that contains more than one EJB module, if you stop and restart one of the EJB modules, the startup service only loads the startup beans related to the restarted EJB module. If the application server breaks down, the stop() methods of the startup beans might fail to execute. However when you restart the application server, the start() methods of the startup beans execute normally.