mirror of https://github.com/jeecgboot/jeecg-boot
commit
e9326cab8c
|
@ -11,6 +11,7 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ public class FlywayConfig {
|
||||||
*/
|
*/
|
||||||
@Value("${spring.flyway.enabled:false}")
|
@Value("${spring.flyway.enabled:false}")
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码格式,默认UTF-8
|
* 编码格式,默认UTF-8
|
||||||
*/
|
*/
|
||||||
|
@ -95,13 +96,13 @@ public class FlywayConfig {
|
||||||
*/
|
*/
|
||||||
@Value("${spring.flyway.clean-disabled:true}")
|
@Value("${spring.flyway.clean-disabled:true}")
|
||||||
private Boolean cleanDisabled;
|
private Boolean cleanDisabled;
|
||||||
|
|
||||||
@Bean
|
@PostConstruct
|
||||||
public void migrate() {
|
public void migrate() {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||||
Map<String, DataSource> dataSources = ds.getDataSources();
|
Map<String, DataSource> dataSources = ds.getDataSources();
|
||||||
dataSources.forEach((k, v) -> {
|
dataSources.forEach((k, v) -> {
|
||||||
|
|
Loading…
Reference in New Issue