How to create an EJB Startup Service
A startup service can be used to eagerly initialize some resources in your application or in external resources.
Thanks to Java EE 6 addition, you don't need anymore vendor solutions which allow to create startup classes.
Just plug in a Bean which is tagged as @Startup and @Singleton
You can monitor the State of your Service by adding a simple property which can be accessed by your clients:
Then your client will simply check the state property and verify what's the current state of the service
Sometimes multiple singleton session beans are used to initialize data for an application and therefore must be initialized in a specific order. In these cases, use the javax.ejb.DependsOn annotation to declare the startup dependencies of the singleton session bean.
Here the PostStartupBean will be fired after the StartupBean is initialized:

