用TransactionTemplate可能直接行使底层的PlatformTransactionManager将事宜代码写在营业代码中。
回收@Transactional注解可能基于设置文件方法,在要领前后举办拦截。非SpringBoot工程,必要在设置文件中插手设置:
- <tx:annotation-driven/>
SpringBoot工程可以用@EnableTransactionManagement注解取代上面的设置内容。
- <aop:config>
- <aop:pointcut expression="execution(public * com.creditease.permission.service.impl.*Impl.*(..))" id="pointcut"/>
- <aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut"/>
- </aop:config>
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="query*" propagation="REQUIRED" read-only="true"/>
- <tx:method name="find*" propagation="REQUIRED" read-only="true"/>
- <tx:method name="save*" propagation="REQUIRED"/>
- <tx:method name="delete*" propagation="REQUIRED"/>
- <tx:method name="add*" propagation="REQUIRED"/>
- <tx:method name="modify*" propagation="REQUIRED"/>
- </tx:attributes>
- </tx:advice>
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|