I want to be able to use my repositories in flyway java migration file. Here's my migration file
@Component
public class V1_2__Insert_Data implements SpringJdbcMigration {
@Autowired
private MyRepository myRepository;
@Override
public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
//logic goes here
}
}
But Spring doesn't inject the repository to the bean. When I pass it as constructor argument, it crashes, because Flyway tries to invoke a non-args constructor. How can I do this?
Versions
flyway -> 5.0.5
spring-boot -> 1.5.9.RELEASE