|
|
|
@ -20,7 +20,9 @@ import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
|
|
|
|
|
|
import org.flywaydb.core.Flyway;
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
|
|
@ -31,6 +33,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.context.annotation.DependsOn;
|
|
|
|
|
import org.springframework.core.io.DefaultResourceLoader;
|
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
@ -52,7 +55,7 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
@Configuration
|
|
|
|
|
@ConditionalOnMissingBean(Flyway.class)
|
|
|
|
|
@EnableConfigurationProperties(FlywayProperties.class)
|
|
|
|
|
public static class LiquibaseConfiguration {
|
|
|
|
|
public static class FlywayConfiguration {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private FlywayProperties properties = new FlywayProperties();
|
|
|
|
@ -93,6 +96,26 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
return flyway;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
@DependsOn("flyway")
|
|
|
|
|
protected BeanPostProcessor forceFlywayToInitialize() {
|
|
|
|
|
|
|
|
|
|
return new BeanPostProcessor() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object postProcessAfterInitialization(Object bean, String beanName)
|
|
|
|
|
throws BeansException {
|
|
|
|
|
return bean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object postProcessBeforeInitialization(Object bean, String beanName)
|
|
|
|
|
throws BeansException {
|
|
|
|
|
return bean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|