aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes What order will multiple @Startup beans be started in? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "What order will multiple @Startup beans be started in?" Watch "What order will multiple @Startup beans be started in?" New topic
Author

What order will multiple @Startup beans be started in?

Michael Remijan
Ranch Hand

Joined: May 29, 2002
Posts: 103

I am using GlassFish 3.1.1 and EE 6. This seems like a common question but I haven't found a great answer yet. If my EJB JAR file contains multiple beans annotated as @Startup, is it possible to configure the order in which they are started? My guess is that if order is important, then I should just have 1 @Startup bean and make sure it does things in the order I want? Optionally, I know about <initialize-in-order> for the application.xml so I suppose I could create multiple JAR files and make sure the JAR files are configured in application.xml in order. Is there any other option? For example, is there another annotation which can be used in conbination with @Startup which will affect the order in which the container creates the beans?


<a href="http://www.linkedin.com/in/mjremijan" rel="nofollow">
<img src="http://www.linkedin.com/img/webpromo/btn_viewmy_160x25.png" border="0" >
</a>
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8141
    
  52

If you ordering of @Startup @Singleton beans to be controlled then you have you use the @DependsOn annotation which takes the names of the other singleton beans on which this bean depends (in terms of ordering).

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: What order will multiple @Startup beans be started in?
 
Similar Threads
Deploying JSP outside oracle home
EJB project startup class
Multiple Sem war files inside of an ear
Unable to load a class specified in your ejb-jar.xml
creating / installing patches