I have a java spring MVC web application build using spring xml configuration, deployed on tomcat server.
My requirement is, whenever the tomcat server starts or get restarted after shut down,I want to clean one table from the database before deploying the war. The database used is mysql.
I have two approaches in my mind right now, one is to keep the table that needs cleanup, in memory using some in memory database. Second one is to make tomcat server to execute the script (that will take care of cleaning the data from table) before deploying the war. But I am looking for a solution that my application can itself take care of cleaning the table before the war deployment. Is there any solution available using spring? Or any other solutions?
Thanks!