-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Closed
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
I am using autoconfiguration with @EnableAutoConfiguration
and I have a Configuration
class that depends on the database schema. I find it weird that the FlyWay migration isn't executed before I am able to use the DataSource or the JdbcTemplate.
What have I done to work around this?
@Configuration
public class DatabaseConfiguration {
private final JdbcTemplate jdbcTemplate;
@Autowired
public DatabaseConfiguration(JdbcTemplate jdbcTemplate, FlywayMigrationInitializer flywayMigrationInitializer) {
this.jdbcTemplate = jdbcTemplate;
}
}
As you can see I am not using the FlywayMigrationInitializer
since I have no use for it but it does what I want but I do not like how.
This would be a lot nicer but it doesn't force the migration to run.
@Configuration
@AutoConfigureAfter(FlywayAutoConfiguration.class)
public class DatabaseConfiguration {
private final JdbcTemplate jdbcTemplate;
@Autowired
public DatabaseConfiguration(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
}
Metadata
Metadata
Assignees
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid