造成这样的错误的原因是:aop切入事务失败
这里:注意这里匹配上所的需要事务的方法
<tx:advice id="advice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/> <!-- 必须有 -->
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS"/> <!-- 有也可以,没有也可以 -->
</tx:attributes>
</tx:advice>
或是这里发生错误:
<aop:config>
<!-- 通过一切 +切面表达式,才是完整切入路径-->
<aop:pointcut id="pointcut" expression="execution(* cn.it.shop.service.impl.*.*(..))"></aop:pointcut>
<!-- 配置哪些包的类要切入整条-->
<aop:advisor advice-ref="advice" pointcut-ref="pointcut"/>
</aop:config>