I have seen many great workarounds to create Flyway JavaMigrations and injecting Spring Beans using @DependsOn
and ApplicationContextAware
(e.g. https://stackoverflow.com/a/48242865/5244937).
However a part of the Flyway 6 documentation claims Dependency Injection would be possible natively for Spring Beans:
- https://flywaydb.org/documentation/api/hooks#java-based-migrations-as-spring-beans
- https://github.com/flyway/flyway/issues/1062
Is is true? How would this work?