|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.pos.datasource;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import com.zaxxer.hikari.HikariDataSource;
|
|
|
|
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
|
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
@ -20,19 +20,17 @@ import java.util.Map;
|
|
|
|
|
@Configuration
|
|
|
|
|
@EnableTransactionManagement
|
|
|
|
|
public class DataSourceConfiguration {
|
|
|
|
|
@Value("${app.datasource.type:'com.alibaba.druid.pool.DruidDataSource'}")
|
|
|
|
|
private Class<? extends DataSource> dataSourceType;
|
|
|
|
|
|
|
|
|
|
@Bean(name = "masterDataSource")
|
|
|
|
|
@ConfigurationProperties(prefix = "app.datasource.master")
|
|
|
|
|
public DataSource masterDataSource() {
|
|
|
|
|
return DataSourceBuilder.create().type(dataSourceType).build();
|
|
|
|
|
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean(name = "slaveDataSource")
|
|
|
|
|
@ConfigurationProperties(prefix = "app.datasource.slave")
|
|
|
|
|
public DataSource slaveDataSource() {
|
|
|
|
|
return DataSourceBuilder.create().type(dataSourceType).build();
|
|
|
|
|
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|