package com.hotent.base.datasource;

import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.sql.DataSource;

/**
 * jdbcTemplate bean
 * @author liangjc
 * @company 广州宏天软件股份有限公司
 * @email liangjc@jee-soft.cn
 * @date 2023-02-14 16:30
 */
@Component("jdbcTemplate")
@Primary
public class DynamicJdbcTemplate extends JdbcTemplate {

    @Resource
    DatabaseContext databaseContext;

    @Override
    public DataSource getDataSource() {
        return databaseContext.getDataSource();
    }
}
