package cn.iocoder.yudao.module.iot.controller.admin.device.config;

import org.springframework.beans.factory.annotation.Qualifier;
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 org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class TDengineConfig {

    @Bean("tdengineJdbcTemplate")
    public JdbcTemplate tdengineJdbcTemplate(DataSource dataSource) {
        // 此处的dataSource会自动注入上面在yml中配置的TDengine数据源
        return new JdbcTemplate(dataSource);
    }

//    @Bean(name = "tdengineDataSource")
//    @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.tdengine")
//    public DataSource tdengineDataSource() {
//        return DataSourceBuilder.create().build();
//    }
}