I would like to execute a code once an application gets deployed completely on JBOSS, is there a way to intercept application deployment on JBOSS, or is there a point where I can be very sure that the application has been deployed completely and I can execute my code just after that point.
Asked
Active
Viewed 109 times
2
-
i am also interested in this question. Maybe @James R. Perkins knows something more about this – MaVRoSCy Jul 30 '12 at 12:15
-
Possible duplicate of [Using special auto start servlet to initialize on startup and share application data](http://stackoverflow.com/questions/3468150/using-special-auto-start-servlet-to-initialize-on-startup-and-share-application) – BalusC Oct 07 '15 at 09:16
1 Answers
0
Reading Execute code after Glassfish Web Deployment i came to the answer of this question.
We have the ability to code a ServletContextListener to be triggered when the context is loaded like this:
public class MyServlet implements ServletContextListener {
public void contextInitialized(ServletContextEvent e) {
// implementation code
}
public void contextDestroyed(ServletContextEvent e) {
// implementation code
}
}
Reference:
Thanks to Garis Suero