package com.ytpm.config.datasource;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * 多数据源配置
 * @Marx
 */
@Configuration
public class DataSourceConfig {

    @Bean(name = "yt_dyz")
    @ConfigurationProperties(prefix = "spring.datasource.dyz")
    public DataSource dyzDataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "yt_qnjz")
    @ConfigurationProperties(prefix = "spring.datasource.qnjz")
    public DataSource qnjzDataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "yt_nofeeds")
    @ConfigurationProperties(prefix = "spring.datasource.nofeeds")
    public DataSource nofeedsDataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "yt_qnmjz")
    @ConfigurationProperties(prefix = "spring.datasource.qnmjz")
    public DataSource qnmjzDataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "yt_xjlrl")
    @ConfigurationProperties(prefix = "spring.datasource.xjlrl")
    public DataSource xjlrlDataSource() {
        return DataSourceBuilder.create().build();
    }
}
