[Y] 修改 datasource 默认值

master
taylor.dang 5 years ago
parent d6a4cbf658
commit 9911ef697f

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.1.0</version> <version>1.1.1</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -20,17 +20,17 @@ import java.util.Map;
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
public class DataSourceConfiguration { public class DataSourceConfiguration {
@Value("${spring.datasource.type}") @Value("${app.datasource.type:'com.alibaba.druid.pool.DruidDataSource'}")
private Class<? extends DataSource> dataSourceType; private Class<? extends DataSource> dataSourceType;
@Bean(name = "masterDataSource") @Bean(name = "masterDataSource")
@ConfigurationProperties(prefix = "spring.datasource.master") @ConfigurationProperties(prefix = "app.datasource.master")
public DataSource masterDataSource() { public DataSource masterDataSource() {
return DataSourceBuilder.create().type(dataSourceType).build(); return DataSourceBuilder.create().type(dataSourceType).build();
} }
@Bean(name = "slaveDataSource") @Bean(name = "slaveDataSource")
@ConfigurationProperties(prefix = "spring.datasource.slave") @ConfigurationProperties(prefix = "app.datasource.slave")
public DataSource slaveDataSource() { public DataSource slaveDataSource() {
return DataSourceBuilder.create().type(dataSourceType).build(); return DataSourceBuilder.create().type(dataSourceType).build();
} }

Loading…
Cancel
Save