title: Run Flyway Java-based callbacks with Spring Boot
body: <p>Is there a way to run <a href="https://flywaydb.org/documentation/api/hooks#callsbacks" rel="noreferrer">Flyway Java-based callbacks</a> with Spring boot?
  I'm converting an existing project that after each migration updates some view definitions, and this is done by Java as it needs some extra logic. I know it could be done in pl/pgsql (we are using Postgres) but it is already done and tested in Java.</p>
  
  <p><a href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html" rel="noreferrer">Spring boot docs</a> says it is possible, but it is listed that the callback scripts should live in same dir as migrations, maybe this works just for SQL based callbacks.</p>
  
  <p>This code works without Spring Boot:</p>
  
  <pre><code>    Flyway flyway = new Flyway();
      flyway.setDataSource(this.getDataSource());
      flyway.setLocations("/db/migration");
      flyway.setCallbacks(new LogMaintenanceFlywayCallback());
      flyway.migrate();
  </code></pre>
  
  <p>I have several migrations in <code>/db/migration</code> and after each one I need to execute my callback. It works in my current project and I need to do the same (or another way to get the same behavior) in Spring Boot.</p>