전자정부3.7 +Mybatis + JPA 조합시, txManager -▶ transactionManager 사용

2018. 3. 28. 15:10IT개발/Spring Boot & Spring Data Rest & JPA

반응형

아래와 같이 txManager 가 아닌 transactionManager 란 네이밍을 사용해야합니다. JPA 내부적으로 해당이름으로 참조하기 때문입니다.


<!-- 

<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

<property name="dataSource" ref="egov.dataSource"/>

</bean> 

-->


<tx:advice id="txAdvice" transaction-manager="transactionManager">

   <tx:attributes>  

       <tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/>

   </tx:attributes>

</tx:advice>

    

<aop:config>

<aop:pointcut id="requiredTx" expression="execution(* egovframework.com..*Impl.*(..)) or

execution(* com..*Impl.*(..)) or

execution(* egovframework.rte.fdl.excel.impl.*Impl.*(..))"/>

<aop:advisor advice-ref="txAdvice" pointcut-ref="requiredTx" />

</aop:config>

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">

<property name="entityManagerFactory" ref="entityManagerFactory" />

</bean>

<!-- @Transactional 스캔 -->

<tx:annotation-driven />

반응형