前些天遇到事务需要排除的情况,直接贴出来~~
1 <!-- 事务配置 --> 2 <tx:advice id="txAdvice" transaction-manager="txManager" > 3 <tx:attributes> 4 <tx:method name="select*" propagation="NOT_SUPPORTED" rollback-for="java.lang.Throwable"/> 5 <tx:method name="get*" propagation="NOT_SUPPORTED" rollback-for="java.lang.Throwable"/> 6 <tx:method name="query*" propagation="NOT_SUPPORTED" rollback-for="java.lang.Throwable"/> 7 <tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/> 8 </tx:attributes> 9 </tx:advice> 10 <aop:config><!-- 事务切入和事务排除 --> 11 <aop:pointcut id="allManagerMethod" expression="execution(* com.aria.service..*.*(..)) and not execution(* com.aria.service.test..*.*(..))"/> 12 <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" /> 13 </aop:config> 14 <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 15 <property name="dataSource" ref="dataSource" /> 16 </bean> 17 <!-- 事务配置 end -->