|  |  |  | 
|---|
|  |  |  | package com.zy.common.config.ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zaxxer.hikari.HikariDataSource; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.sql.DataSource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static com.sun.xml.internal.ws.spi.db.BindingContextFactory.LOGGER; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Configuration | 
|---|
|  |  |  | public class DataSourceConfig { | 
|---|
|  |  |  | 
|---|
|  |  |  | // 次数据源 | 
|---|
|  |  |  | @Bean(name = "slaveDataSource") | 
|---|
|  |  |  | public DataSource secondaryDataSource() { | 
|---|
|  |  |  | System.out.println(driverClassName); | 
|---|
|  |  |  | return DataSourceBuilder.create() | 
|---|
|  |  |  | .driverClassName(driverClassName) | 
|---|
|  |  |  | .url(url) | 
|---|