|
|
@ -49,6 +49,10 @@ import org.springframework.core.Ordered;
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
import org.springframework.core.io.DefaultResourceLoader;
|
|
|
|
import org.springframework.core.io.DefaultResourceLoader;
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
|
|
|
|
import org.springframework.jdbc.core.JdbcOperations;
|
|
|
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
|
|
|
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
|
|
|
|
|
|
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
|
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
|
|
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
|
|
|
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@ -293,6 +297,13 @@ class FlywayAutoConfigurationTests {
|
|
|
|
.run((context) -> assertThat(context).hasNotFailed());
|
|
|
|
.run((context) -> assertThat(context).hasNotFailed());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void customFlywayWithJdbc() {
|
|
|
|
|
|
|
|
this.contextRunner
|
|
|
|
|
|
|
|
.withUserConfiguration(EmbeddedDataSourceConfiguration.class, CustomFlywayWithJdbcConfiguration.class)
|
|
|
|
|
|
|
|
.run((context) -> assertThat(context).hasNotFailed());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void overrideBaselineVersionString() {
|
|
|
|
void overrideBaselineVersionString() {
|
|
|
|
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
|
|
@ -530,7 +541,7 @@ class FlywayAutoConfigurationTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
Flyway flyway() {
|
|
|
|
Flyway customFlyway() {
|
|
|
|
return Flyway.configure().load();
|
|
|
|
return Flyway.configure().load();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -545,6 +556,32 @@ class FlywayAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
|
|
|
static class CustomFlywayWithJdbcConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DataSource dataSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected CustomFlywayWithJdbcConfiguration(DataSource dataSource) {
|
|
|
|
|
|
|
|
this.dataSource = dataSource;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
Flyway customFlyway() {
|
|
|
|
|
|
|
|
return Flyway.configure().load();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
JdbcOperations jdbcOperations() {
|
|
|
|
|
|
|
|
return new JdbcTemplate(this.dataSource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
NamedParameterJdbcOperations namedParameterJdbcOperations() {
|
|
|
|
|
|
|
|
return new NamedParameterJdbcTemplate(this.dataSource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
static class MockFlywayMigrationStrategy implements FlywayMigrationStrategy {
|
|
|
|
static class MockFlywayMigrationStrategy implements FlywayMigrationStrategy {
|
|
|
|
|
|
|
|
|
|
|
|