package com.tofly.gpsboot.config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

@Configuration
public class TwoDataSourceConfig {
    @Primary
    @Bean(name = "firstDataSource")
    @ConfigurationProperties("spring.datasource")
    public DataSource first() {
        return DruidDataSourceBuilder.create().build();
    }
}
