I am trying to flyway for the migration demo. In which I am able to migrate code. I have extended BaseFlywayCallback and I want to print migration info before and after each migration. I have code in other service class for printing info. I am auto wiring it but it is not working there. I have tried some other ways but nothing worth it.
@Autorired
PrintInfoService service
How can I do that?
The integration with flyway internally in spring boot is done by means of using FlywayAutoConfiguration
It has to create a Flyway
bean on which it will register all callbacks found in the classpath.
I can't test this, but you I believe you have to:
FlywayAutoConfiguration
's:public Flyway flyway(FlywayProperties properties, DataSourceProperties dataSourceProperties,
ResourceLoader resourceLoader, ObjectProvider<DataSource> dataSource,
@FlywayDataSource ObjectProvider<DataSource> flywayDataSource,
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers,
ObjectProvider<JavaMigration> javaMigrations, ObjectProvider<Callback> callbacks)