<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    					http://www.springframework.org/schema/util
				        http://www.springframework.org/schema/util/spring-util-4.0.xsd">
    
    <!-- 환경설정 기본정보를 globals.properties 에서 참조하도록 propertyConfigurer 설정  -->
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:/egovframework/egovProps/globals_#{systemProperties['spring.profiles.active']}.properties</value>
            </list>
        </property>
    </bean>
    <util:properties id="property" location="classpath:/egovframework/egovProps/globals_#{systemProperties['spring.profiles.active']}.properties" />
    
    <!-- datasource 설정(propertyConfigurer 활용) -->
    <alias name="dataSource-${Globals.DbType}" alias="dataSource" />
    <alias name="dataSource-${Globals.DbType}" alias="egov.dataSource" />
    
    <!-- mysql-->
    <bean id="dataSource-mysql-spied" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${Globals.DriverClassName}"/>
        <property name="url" value="${Globals.Url}" />
        <property name="username" value="${Globals.UserName}"/>
        <property name="password" value="${Globals.Password}"/>
        <property name="initialSize" value="30"/>
        <property name="maxActive" value="100"/>
        <property name="maxWait" value="-1"/>
        <!-- 특정 시간마다 validationQuery를 실행 셋팅 시작 -->
        <property name="validationQuery" value="select 1"/>
        <property name="testWhileIdle" value="true"/>
        <property name="timeBetweenEvictionRunsMillis" value="7200000"/>
        <!-- 특정 시간마다 validationQuery를 실행 셋팅 끝 -->
    </bean>
    
	<bean id="dataSource-mysql" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
		<constructor-arg ref="dataSource-mysql-spied" />
		<property name="logFormatter">
			<bean class="itn.let.utl.log4j.Log4JdbcCustomFormatter">
				<property name="loggingType" value="MULTI_LINE" />
				<property name="margin" value="8" />
				<property name="sqlPrefix" value="SQL:" />
			</bean>
		</property>
	</bean>
	
    <!-- Oracle -->
    <bean id="dataSource-oracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@192.168.0.15:1521:ORCL" />
        <property name="username" value="KCDF_TEMP"/>
        <property name="password" value="kcdf"/>
    </bean>
    
    <!-- kcdf migration db -->
    <bean id="dataSource-kcdf" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="core.log.jdbc.driver.MysqlDriver"/>
        <property name="url" value="jdbc:mysql://121.163.40.153:3306/kcdf_new" />
        <property name="username" value="kcdf_new"/>
        <property name="password" value="kcdf_new"/>
    </bean>
    										
    <!-- Oracle -->
    <!-- 기존소스 -->
    <!-- <bean id="dataSource-oracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${Globals.DriverClassName}"/>
        <property name="url" value="${Globals.Url}" />
        <property name="username" value="${Globals.UserName}"/>
        <property name="password" value="${Globals.Password}"/>
    </bean> -->
    
    <!-- Altibase -->
    <bean id="dataSource-altibase" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${Globals.DriverClassName}"/>
        <property name="url" value="${Globals.Url}" />
        <property name="username" value="${Globals.UserName}"/>
        <property name="password" value="${Globals.Password}"/>
        <property name="maxActive" value="10"/>
    </bean>

    <!-- Tibero -->
    <bean id="dataSource-tibero" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${Globals.DriverClassName}"/>
        <property name="url" value="${Globals.Url}" />
        <property name="username" value="${Globals.UserName}"/>
        <property name="password" value="${Globals.Password}"/>
    </bean>
	
	<!-- cubrid -->
    <bean id="dataSource-cubrid" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${Globals.DriverClassName}"/>
        <property name="url" value="${Globals.Url}" />
        <property name="username" value="${Globals.UserName}"/>
        <property name="password" value="${Globals.Password}"/>
    </bean>
    
</beans>
