Browse Source

删除多余包

master
liuchao 4 years ago
parent
commit
80b1959829
  1. 1
      src/main/java/com/ceis/convert/conf/MssqlDataSourceConfigurer.java
  2. 22
      src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java
  3. 8
      src/main/java/com/ceis/convert/conf/MysqlDataSourceConfigurer.java

1
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(); return factoryBuilder.dataSource(mssqlDataSource).properties(jpaProperties.getProperties()).packages("com.ceis.convert.entity.mssql").persistenceUnit("mssqlPersistenceUnit").build();
} }
@Primary @Primary
@Bean(name = "mssqlTransactionManager") @Bean(name = "mssqlTransactionManager")
public PlatformTransactionManager mssqlTransactionManager(){ public PlatformTransactionManager mssqlTransactionManager(){

22
src/main/java/com/ceis/convert/conf/MultiDataSourceConfig.java

@ -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")

8
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.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.domain.EntityScan; 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.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.boot.orm.jpa.EntityManagerFactoryBuilder;
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.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@ -22,8 +16,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;
@AutoConfigureAfter(MultiDataSourceConfig.class) @AutoConfigureAfter(MultiDataSourceConfig.class)
@Configuration @Configuration

Loading…
Cancel
Save