<!-- springframework의 DriverManagerDataSource를 이용하여 dataSource 설정 -->
<bean id="doDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.url}"
p:username="${jdbc.username}"
p:password="#{getDatabasePassword()}"
/>
<bean id="commonSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref ="doDataSource"></property>
<property name="mapperLocations" value="classpath:mapper/common/*Mapper.xml"></property>
<property name="configLocation" value="classpath:test/java/resources/config/mybatisAlias.xml"></property>
</bean>
<bean id="commonSqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="clearCache">
<constructor-arg name="sqlSessionFactory" ref="commonSqlSessionFactory" />
</bean>
<!-- Transaction manager for a single JDBC DataSource -->
<bean id="doTransaction"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="doDataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="doTransaction">
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<!-- other methods use the default transaction settings (see below) -->
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="set*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="txPointcut" expression="execution(* kr.co.jirandata.idfilter.service..*Imp.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />
</aop:config>
<bean id="certiwareDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="${jdbc.driverClassName}"
p:url="${certiware.jdbc.url}"
p:username="${certiware.jdbc.username}"
p:password="${certiware.jdbc.password}"
/>
<bean id="certiwareSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref ="certiwareDataSource"></property>
<property name="mapperLocations" value="classpath:mapper/certiware/*Mapper.xml"></property>
<property name="configLocation" value="classpath:test/java/resources/config/mybatisAlias.xml"></property>
</bean>
<bean id="certiwareSqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="clearCache">
<constructor-arg name="sqlSessionFactory" ref="certiwareSqlSessionFactory" />
</bean>
<!-- scan mybatis mapper-->
<mybatis:scan base-package="kr.co.jirandata.idfilter.mapper.common" factory-ref="commonSqlSessionFactory"/>
<mybatis:scan base-package="kr.co.jirandata.idfilter.mapper.certiware" factory-ref="certiwareSqlSessionFactory"/>