Recently encountered in the project when the Pring transaction does not work, and later resolved, here I summarize:
1, first use the following code to confirm that your bean is the proxy object?
A transaction must be a bean that is defined by the spring (either through XML or annotation definitions).
Adding transactions directly to new objects is not working.
You can determine whether a proxy object is in the following ways:
Aoputils.isaopproxy (Object object)
Aoputils.iscglibproxy (Object Object)//cglib
Aoputils.isjdkdynamicproxy (Object Object)//jdk dynamic Proxy
2. The entry function must be public, otherwise the transaction will not work. This is determined by spring's AOP characteristics.
3, pointcut configuration error.
<!--configure transactions using annotation annotations--
<tx:annotation-driven transaction-manager= "TransactionManager" proxy-target-class= "true"/>
<!--Configure transactions using facets---
<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" >
<tx:attributes>
<tx:method name= "*" isolation= "read_committed" propagation= "REQUIRED" rollback-for= "Java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id= "pointcut" expression= "Execution (* com.tyyd). *service.do* (..)) " />
<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Pointcut"/>
</aop:config>
4. If you use SPRINGMVC, it may be caused by a context:component-scan repeat scan:
5, such as the use of MySQL and the engine is MyISAM caused (because the transaction is not supported), InnoDB can be changed.
[Java] [Spring] Spring transaction does not work problem rollup