//package com.yeejoin.amos.boot.module.jxiop.biz.config;
//import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.apache.ibatis.type.JdbcType;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.boot.autoconfigure.MybatisProperties;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.Resource;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//import java.io.IOException;
//import java.util.Optional;
//import java.util.stream.Stream;
//
//@Configuration
//@EnableConfigurationProperties(MybatisProperties.class)
//public class DataSource2Config {
//    @Bean(name = "db2DataSource")
//    @ConfigurationProperties(prefix = "spring.db2.datasource")
//    public DataSource db3DataSource() {
//        return DruidDataSourceBuilder.create().build();
//    }
//
//    @Bean(name = "db2SqlSessionFactory")
//    public SqlSessionFactory db2SqlSessionFactory(@Qualifier("db2DataSource") DataSource datasource)
//            throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//        bean.setDataSource(datasource);
//        bean.setMapperLocations(
//                new PathMatchingResourcePatternResolver().getResources("classpath*:oraclemappers/*.xml"));
//        return bean.getObject();
//    }
//
//    @Bean(name="db2transactionManager")
//    public DataSourceTransactionManager transactionManagerOne(){
//        return  new DataSourceTransactionManager(db3DataSource());
//    }
//
//    @Bean(name = "db2JdbcTemplate")
//    public JdbcTemplate jdbcTemplate(
//            @Qualifier("db2DataSource") DataSource dataSource) {
//        return new JdbcTemplate(dataSource);
//    }
//}
