Commit 92f4e945 by huluobin

# update

parent a8836dd9
package com.bailuntec.job;
import com.zaxxer.hikari.HikariDataSource;
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;
......@@ -19,19 +21,46 @@ import javax.sql.DataSource;
@Configuration
public class DataSourceConfig {
@Bean
@ConfigurationProperties(prefix = "spring.dataflow-datasource")
public DataSourceProperties dataflowDataSourceProperties() {
return new DataSourceProperties();
}
@Bean
public DataSource dataflowDataSource() {
return DataSourceBuilder.create().build();
DataSourceProperties dataSourceProperties = dataflowDataSourceProperties();
return DataSourceBuilder
.create(dataSourceProperties.getClassLoader())
.driverClassName(dataSourceProperties.getDriverClassName())
.url(dataSourceProperties.getUrl())
.username(dataSourceProperties.getUsername())
.password(dataSourceProperties.getPassword())
.type(HikariDataSource.class)
.build();
}
@Primary
@Bean
@ConfigurationProperties(prefix = "spring.dataflow")
@ConfigurationProperties(prefix = "spring.datasource")
public DataSourceProperties bizDataSourceProperties() {
return new DataSourceProperties();
}
@Primary
@Bean
public DataSource bizDataSource() {
return DataSourceBuilder.create().build();
DataSourceProperties dataSourceProperties = bizDataSourceProperties();
return DataSourceBuilder
.create(dataSourceProperties.getClassLoader())
.driverClassName(dataSourceProperties.getDriverClassName())
.url(dataSourceProperties.getUrl())
.username(dataSourceProperties.getUsername())
.password(dataSourceProperties.getPassword())
.type(HikariDataSource.class)
.build();
}
}
......@@ -8,7 +8,7 @@ spring:
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
dataflow-dataSource:
dataflow-datasource:
url: jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT}/mysql
username: root
password: ${mysql-root-password}
......
......@@ -4,12 +4,12 @@ spring:
name: base-sync-ebay
# 数据配置
datasource:
jdbcUrl: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datecenter_test?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datecenter_test?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
dataflow-dataSource:
jdbcUrl: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datecenter_test?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
dataflow-datasource:
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datecenter_test?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment