|
@ -1,31 +1,18 @@ |
|
|
package com.ceis.convert.conf; |
|
|
package com.ceis.convert.conf; |
|
|
|
|
|
|
|
|
import com.zaxxer.hikari.HikariDataSource; |
|
|
import com.zaxxer.hikari.HikariDataSource; |
|
|
import org.springframework.beans.factory.BeanClassLoaderAware; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Configurable; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; |
|
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
|
import org.springframework.boot.jdbc.DataSourceBuilder; |
|
|
import org.springframework.boot.jdbc.DataSourceBuilder; |
|
|
import org.springframework.context.annotation.Bean; |
|
|
import org.springframework.context.annotation.Bean; |
|
|
import org.springframework.context.annotation.Configuration; |
|
|
import org.springframework.context.annotation.Configuration; |
|
|
import org.springframework.context.annotation.Primary; |
|
|
import org.springframework.context.annotation.Primary; |
|
|
import org.springframework.context.annotation.Profile; |
|
|
|
|
|
|
|
|
|
|
|
import javax.sql.DataSource; |
|
|
import javax.sql.DataSource; |
|
|
|
|
|
|
|
|
@Configuration |
|
|
@Configuration |
|
|
public class MultiDataSourceConfig{ |
|
|
public class MultiDataSourceConfig{ |
|
|
|
|
|
|
|
|
// @Bean(value = "mssqlDataSourceProperties")
|
|
|
|
|
|
// @Primary
|
|
|
|
|
|
// @Qualifier("mssqlDataSourceProperties")
|
|
|
|
|
|
// @ConfigurationProperties(prefix = "spring.datasource.mssql")
|
|
|
|
|
|
// public DataSourceProperties mssqlDataSourceProperties(){
|
|
|
|
|
|
// System.out.println("-------------------- mssqlDataSourceProperties初始化 ---------------------");
|
|
|
|
|
|
// return new DataSourceProperties();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@Bean(value = "mssqlDataSource") |
|
|
@Bean(value = "mssqlDataSource") |
|
|
@Primary |
|
|
@Primary |
|
|
@Qualifier("mssqlDataSource") |
|
|
@Qualifier("mssqlDataSource") |
|
@ -35,15 +22,6 @@ public class MultiDataSourceConfig{ |
|
|
return DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|
|
return DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @Bean(value = "mysqlDataSourceProperties")
|
|
|
|
|
|
// @Primary
|
|
|
|
|
|
// @Qualifier("mysqlDataSourceProperties")
|
|
|
|
|
|
// @ConfigurationProperties(prefix = "spring.datasource.mysql")
|
|
|
|
|
|
// public DataSourceProperties mysqlDataSourceProperties(){
|
|
|
|
|
|
// System.out.println("-------------------- mysqlDataSourceProperties初始化 ---------------------");
|
|
|
|
|
|
// return new DataSourceProperties();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
@Bean |
|
|
@Qualifier("mysqlDataSource") |
|
|
@Qualifier("mysqlDataSource") |
|
|