你的位置:首页 > Java教程

[Java教程]Springmvc + mybatis + spring 配置,spring事物

今天配置了半天,发现,事物不起效果,主要出现如下错误:

org.mybatis.spring.transaction.SpringManagedTransaction] - [JDBC Connection [[email protected]] will not be managed by SpringSqlSession [[email protected]] was not registered for synchronization because synchronization is not activeClosing non transactional SqlSession

 

后台看到大象的博文才找到答案,意思就是要排出spring [email protected],不然会导致事物配置失效,[email protected]

Spring MVC启动时的配置文件,包含组件扫描、url映射以及设置freemarker参数,[email protected]设置?因为servlet-context.

 

 

 

1 <!-- 定义控制器注解扫描包路径,控制器注解为 @Controller ,[email protected] -->2   <context:component-scan base-package="com.teshehui.product">3     <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation" />4     <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>5   </context:component-scan>

 

 

参考: Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(二)