|
@@ -1,43 +1,18 @@
|
|
|
package com.tzld.longarticle.recommend.server.config.db;
|
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
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.data.jpa.repository.config.EnableJpaRepositories;
|
|
|
-import org.springframework.orm.jpa.JpaTransactionManager;
|
|
|
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
|
-import org.springframework.transaction.PlatformTransactionManager;
|
|
|
-import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
|
|
-import javax.persistence.EntityManagerFactory;
|
|
|
import javax.sql.DataSource;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
@Configuration
|
|
|
public class GrowthDBConfig {
|
|
|
|
|
|
- @Value("${spring.jpa.growth.hibernate.ddl-auto}")
|
|
|
- private String ddlAuto;
|
|
|
- @Value("${spring.jpa.growth.database}")
|
|
|
- private String database;
|
|
|
-
|
|
|
- public Map<String, Object> hibernateProperties() {
|
|
|
- Map<String, Object> properties = new HashMap<>();
|
|
|
- properties.put("hibernate.ddl-auto", ddlAuto);
|
|
|
- properties.put("database", database);
|
|
|
- return properties;
|
|
|
- }
|
|
|
-
|
|
|
- @Primary
|
|
|
@Bean(name = "growthDataSource")
|
|
|
@ConfigurationProperties(prefix = "spring.datasource.growth")
|
|
|
- public DataSource crawlerDataSource() {
|
|
|
+ public DataSource growthDataSource() {
|
|
|
return DataSourceBuilder.create().build();
|
|
|
}
|
|
|
}
|