0
点赞
收藏
分享

微信扫一扫

Manual close is not allowed over a Spring managed SqlSession


 Manual close is not allowed over a Spring managed SqlSession

解决办法:在全局配置文件   class="org.mybatis.spring.SqlSessionTemplate" 后面加  scope="prototype"

spring 默认scope 是单例模式
这样只会创建一个Action对象
每次访问都是同一个Action对象,数据不安全
struts2 是要求 每次次访问 都对应不同的Action
scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象

举报

相关推荐

0 条评论