fairnet/src/main/resources/egovframework/spring/com/context-datasource.xml
2024-08-06 16:22:19 +09:00

74 lines
3.7 KiB
XML

<?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="kcc.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-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}" />
</bean>
<bean id="dataSource-oracle" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
<constructor-arg ref="dataSource-oracle-spied" />
<property name="logFormatter">
<bean class="kcc.let.utl.log4j.Log4JdbcCustomFormatter">
<property name="loggingType" value="MULTI_LINE" />
<property name="margin" value="8" />
<property name="sqlPrefix" value="SQL:" />
</bean>
</property>
</bean>
<bean id="mybatisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jndi/XE"/>
<property name="resourceRef" value="true" />
</bean>
</beans>