本地事物配置后不生效可能有很多情况。我在配置出现的问题
1,MySQL存储引擎是否是InnoDB。
2,项目配置时。在web.xml中配置
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:/spring-mongo.xml
classpath*:/spring-mybatis.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
发现上面配置的在项目中事物不生效。 然后改在spring-mvc.xml中引入
<import resource="spring-mybatis.xml"/>
<import resource="spring-mongo.xml"/>
配置的本地事物就可以生效了。