Liquibase has a servlet option to initialize the database. http://liquibase.org/manual/servlet_listener
Is there an example of this for Flyway? Or, better yet a working servlet?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you really want, is to run
flyway.migrate()on startup. This can be accomplished through a variety of ways, Servlet Listeners being one of them.There is no servlet listener included out of the box, but it’s trivial to roll your own.
It should look something like this:
A class implementing the
ServletContextListenerinterface is called before the first servlet (or filter) invocation and after the last. The@WebListenerannotation is one way to inform your Servlet container of your intended listener. For more info, see this Oracle Tutorial and search Stack Overflow.