How to run a program on application startup in tomcat?
posted 4 years ago
My requirement is to run a java program as soon as my web app loads on the tomcat server. What is the best way to do it?
I was thinking of calling the method inside the init() method of the servlet, but if i am correct that might run the program during the application startup or might run it when the first request hits. So how do ensure that the method is called when the application is loaded on the server.
You may also recommend me a better way of doing so.