In my Spring Boot app I use Flyway for DB migrations and MyBatis together. Problem is that MyBatis is initialized before Flyway, so some DB operations are called (within @PostConstruct) before DB migration.
If I take a look into FlywayAutoConfiguration there is:
@AutoConfigureAfter({DataSourceAutoConfiguration.class, ...})
public class FlywayAutoConfiguration {
...
As I understand, I need override FlywayAutoConfiguration and add:
@AutoConfigureAfter({DataSourceAutoConfiguration.class})
@AutoConfigureBefore({MybatisAutoConfiguration.class})
public class FlywayAutoConfiguration {
...
Not sure how to do that. Thanks for any help.