spring+mybatis+struts 登陆时,因为密码不正确,或没有权限等问题,导致登陆了3次,这时后台 Fetching JDBC Connection from DataSource,一直等待。找了半天发现时login方法事物没有起作用,我的配置文件是这样的:
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="select*" propagation="REQUIRED" read-only="true"/>
<tx:method name="Search*" propagation="REQUIRED" read-only="true"/>
<tx:method name="Count*" propagation="REQUIRED" read-only="true"/>
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
把login 方法改成了selectlogin问题就解决了,在这里做个标记
本文介绍了一个关于Spring+MyBatis+Struts框架下登录功能的问题及解决方案。当用户因密码错误等原因连续尝试登录三次时,系统出现等待状态。通过调整事务配置,将登录方法标记为查询类型(selectLogin),成功解决了该问题。
2581

被折叠的 条评论
为什么被折叠?



