<!-- jotm 설정 -->
<bean id="jotm"
class="org.springframework.transaction.jta.JotmFactoryBean" />
<!-- jotm를 property로 가지는 JtaTransactionManager설정 -->
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager" p:userTransaction-ref="jotm" />
<!-- StandardXAPoolDataSource를 이용한 postgresSQL dataSource설정 -->
<bean id="postgresDBDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="shutdown">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/testDb?charSet=UTF-8" />
</bean>
</property>
<property name="user" value="test" />
<property name="password" value="test" />
</bean>
<!-- StandardXAPoolDataSource를 이용한 oracle dataSource설정 -->
<bean id="oracleDBDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="shutdown">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1526:TEST" />
</bean>
</property>
<property name="user" value="test" />
<property name="password" value="test" />
</bean>
<!-- postgresSQL dataSource를 property로 하는 slqMapClient설정 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="/WEB-INF/config/sqlmap-config.xml"/>
<property name="dataSource" ref="postgresDBDataSource"/>
</bean>
<!-- oracle dataSource를 property로 하는 slqMapClient설정 -->
<bean id="oracleDbSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="/WEB-INF/config/sqlmap-config.xml"/>
<property name="dataSource" ref="oracleDBDataSource"/>
</bean>
<!-- postgresSQL dataSource를 property로 하는 slqMapClient를 가지는 dao -->
<bean id="postgresDbDao" class="test.dao.PostgresDbDao">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
<!-- oracle dataSource를 property로 하는 slqMapClient를 가지는 dao -->
<bean id="oracleDbDao" class="test.dao.OracleDbDao">
<property name="sqlMapClient" ref="oracleDbSqlMapClient" />
</bean>
<!-- The business Logic are autodetected POJOs labeled with the @Service annotaion -->
<context:component-scan base-package="test.service" scoped-proxy="targetClass" />
<context:annotation-config />
<!-- annotation으로 transcation를 선언 이때 transactionManager를 jotm transactionManager로 한다 -->
<tx:annotation-driven transaction-manager="transactionManager"/> |