diff --git a/src/main/java/com/ceis/convert/conf/MssqlDataSourceConfigurer.java b/src/main/java/com/ceis/convert/conf/MssqlDataSourceConfigurer.java index 0e58cc6..4e6af74 100644 --- a/src/main/java/com/ceis/convert/conf/MssqlDataSourceConfigurer.java +++ b/src/main/java/com/ceis/convert/conf/MssqlDataSourceConfigurer.java @@ -52,7 +52,6 @@ public class MssqlDataSourceConfigurer { return factoryBuilder.dataSource(mssqlDataSource).properties(jpaProperties.getProperties()).packages("com.ceis.convert.entity.mssql").persistenceUnit("mssqlPersistenceUnit").build(); } - @Primary @Bean(name = "mssqlTransactionManager") public PlatformTransactionManager mssqlTransactionManager(){ diff --git a/src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java b/src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java index df341ed..2b5f95e 100644 --- a/src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java +++ b/src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java @@ -1,31 +1,18 @@ package com.ceis.convert.conf; 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.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; import javax.sql.DataSource; @Configuration 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") @Primary @Qualifier("mssqlDataSource") @@ -35,15 +22,6 @@ public class MultiDataSourceConfig{ 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 @Qualifier("mysqlDataSource") diff --git a/src/main/java/com/ceis/convert/conf/MysqlDataSourceConfigurer.java b/src/main/java/com/ceis/convert/conf/MysqlDataSourceConfigurer.java index 6c6fc80..3ab2c88 100644 --- a/src/main/java/com/ceis/convert/conf/MysqlDataSourceConfigurer.java +++ b/src/main/java/com/ceis/convert/conf/MysqlDataSourceConfigurer.java @@ -4,16 +4,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties; -import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings; import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; @@ -22,8 +16,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.persistence.EntityManager; import javax.sql.DataSource; -import java.util.HashMap; -import java.util.Map; @AutoConfigureAfter(MultiDataSourceConfig.class) @Configuration