Reputation: 5
I wonder if you could help me with this:
At first sorry if I am asking something easy, but I am amateur in this.
I have a tomcat server in my computer and I have several services (programmed in java language with Eclipse) in it. What I would like to know is if it is possible to stablish a code that should be execute in each service when Tomcat server turns on or reset. If it is possible, how could I do that?
Upvotes: 0
Views: 73
Reputation: 166
You can create a Context Creation listener.(ServletContextListener)
Upvotes: 0
Reputation: 139931
A ServletContextListener
is meant for exactly this type of thing. Your implementation of contextInitialized()
will be called when the server starts the "context" (meaning the webapp).
Upvotes: 2