在applicationContext.xml中配置中配置以下内容
applicationContext.xml
1 | <!--配置事务增强,事务如何切入--> |
发现报错后事务没有回滚,将controller改成service后(如下),service层是可以回滚的。
applicationContext.xml
1 | <!--配置事务增强,事务如何切入--> |
如果想要controller层回滚,则需要把切入点配置在spring-mvc.xml中
spring-mvc.xml
1 | <aop:config> |
applicationContext.xml
1 | <!--配置事务增强,事务如何切入--> |
这样controller层就可以回滚了,但如果在spring-mvc.xml中配置层service(如下),是不生效的,service并不会回滚
spring-mvc.xml
1 | <aop:config> |