Created
June 20, 2012 14:01
-
-
Save tsegismont/2960038 to your computer and use it in GitHub Desktop.
Default Transaction Interception for spring @service objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> | |
<property name="entityManagerFactory" ref="entityManagerFactory" /> | |
<property name="dataSource" ref="myDS" /> | |
</bean> | |
<tx:annotation-driven transaction-manager="transactionManager" /> | |
<aop:config> | |
<aop:pointcut id="defaultServiceMethodTxPointcut" | |
expression="execution([email protected] * *(..)) | |
and @within(org.springframework.stereotype.Service) | |
and (!@within(org.springframework.transaction.annotation.Transactional)) " /> | |
<aop:advisor advice-ref="defaultServiceMethodTxAdvice" pointcut-ref="defaultServiceMethodTxPointcut" /> | |
</aop:config> | |
<tx:advice id="defaultServiceMethodTxAdvice" transaction-manager="transactionManager"> | |
<tx:attributes> | |
<tx:method name="get*" propagation="SUPPORTS" read-only="true" /> | |
<tx:method name="is*" propagation="SUPPORTS" read-only="true" /> | |
<tx:method name="find*" propagation="SUPPORTS" read-only="true" /> | |
<tx:method name="load*" propagation="SUPPORTS" read-only="true" /> | |
<tx:method name="*" propagation="REQUIRED" /> | |
</tx:attributes> | |
</tx:advice> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment