什么导致spring事务失效
今天有个朋友问我一个事务不起作用的问题,如果对事务代理不了解的话,这个问题需要引起大家注意。 先看配置文件: <!-- 配置事务拦截器--> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <!-- 事务拦截器bean需要依赖注入一个事务管理器 --> <property name="transactionManager" ref="myTransactionManager"/> <property name="transactionAttributes"> <!-- 下面定义事务传播属性--> <props> <!--del开头的方法都被事物管理--> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="set*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly<