maven工程下整合spring+mybatis报Mapped Statements collection does not contain value for spring-mybatis-user-get错误
在整合spring+mybatis报了下面的错误:
Mapped Statements collection does not contain value for spring-mybatis-user-get,找了很久也没找到正确的方法。经过排查,发现mybatis的mapper.xml
位于和src/main/java一样的包下,如下图
User.xml文件位于spring.mybatis.user下,在src/main/java和src/main/resources下都有这个路径的包,而我在spring中mybatis的配置如下
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean"
p:dataSource-ref="dataSource"
p:configLocation="classpath:myBatisConfig.xml"
p:mapperLocations="classpath:spring/mybatis/user/**/*.xml"/>
因此,我怀疑扫描mapperxml文件时,在src/main/java和src/main/resources下有一样的包时,会以src/main/java中的
为准,因此,我将src/main/resources下的包改成spring.mybatis.iuser,同时将spring配置的路径改成classpath:spring/mybatis/iuser/**/*.xml,即
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean"
p:dataSource-ref="dataSource"
p:configLocation="classpath:myBatisConfig.xml"
p:mapperLocations="classpath:spring/mybatis/iuser/**/*.xml"/>
再次运行单元测试,通过!困扰了一天的问题终于解决了。
maven工程下整合spring+mybatis报Mapped Statements collection does not contain value for spring-mybatis-user-get错误的更多相关文章
- 总结在ssm整合中,Mybatis出现Mapped Statements collection already contains value for xxxxx的解决方案
先贴一段报错信息: 前面的都不是很重要,看最后灰色标注的那段.... 严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.Contex ...
- myBatis出现Mapped Statements collection already contains value for
造成这个问题的原因很多,我遇到的主要是因为 <select id="queryCountfor****" parameterType="java.lang.Inte ...
- 关于Mybatis 的 Mapped Statements collection does not contain value for 异常 解决方案
查看堆栈信息: at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:595) at org.apac ...
- Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作
详细的Spring MVC框架搭配在这个连接中: Maven 工程下 Spring MVC 站点配置 (一) Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作 这篇主 ...
- Spring+Mybatis整合报错Mapped Statements collection does not contain value原因之一
报错如下: ### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements coll ...
- Maven 工程下 Spring MVC 站点配置 (三) C3P0连接池与@Autowired的应用
Maven 工程下 Spring MVC 站点配置 (一) Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作 前两篇文章主要是对站点和数据库操作配置进行了演示,如果单 ...
- Maven 工程下 Spring MVC 站点配置 (一)
最近,查找一些具体资料时,虽然会有很多,但是系统的却很少,尤其是对maven 下 spring mvc 站点搭建的配置,总是说的很多但让新手一目了然的步骤却少之又少. 对此闲暇时整理了一下,做了一套较 ...
- Maven工程下报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
Maven工程下,webapp下面新建index.jsp文件,报如下错误. 原因很简单,没有安装如下maven依赖包: <dependencies> <!-- JSP相关 --> ...
- Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value
问题一: mybatisPlus完全兼容mybatis,一般来说直接替换掉就可以了,如果mybatis的数据源不能取消创建的话,就注掉mybatisplus的数据源 //@Configurationp ...
随机推荐
- 笔记一(固件、BIOS、UEFI)
1.固件 固件一般是指保存在ROM中的程序和数据,通过固件操作系统按照标准的设备驱动实现特定机器的运行. 简单来讲,固件就是固化在ROM的软件,当然也可以通过特定的工具进行升级. MP3.MP4.手机 ...
- 微擎转移服务器后,出现 require()错误,解决方案
微擎中切换服务器后出现该问题,有可能是导致配置的问题
- js的dom操作(整理)(转)
js的dom操作整理(整理)(转) 一.总结 一句话总结: dom操作有用原生js的dom操作,也可以用对js封装过的jquery等插件来来更加方便的进行dom操作 1.dom是什么? 对于JavaS ...
- 中间件 | kafka简介、使用场景、设计原理、主要配置及集群搭建
开源Java学习 公众号 一.入门 1.简介 Kafka is a distributed,partitioned,replicated commit logservice.它提供了类似于JMS的特性 ...
- mysql查询json字段
一张test表里存了一个content字段是json类型的,查询该content里manualNo这个字段 select JSON_EXTRACT (test .content, '$.manualN ...
- Hibernate3运行原理
Hibernate的运行过程如下: 1.应用程序先调用Configuration类,该类读取Hibernate配置文件及映射文件中的信息,2.并用这些信息生成一个SessionFactory对象,3. ...
- python从入门到放弃之Tensorflow(一)
Tensorflow使用错误集锦: 错误1 : FutureWarning: Conversion of the second argument of issubdtype from ‘float’ ...
- 如何写resultful接口
一.协议 API与客户端用户的通信协议,总是使用HTTPS协议,以确保交互数据的传输安全. 二.域名 应该尽量将API部署在专用域名之下: https://api.example.com 如果确定AP ...
- Java日志体系(四)slf4j
1.1 简介 与commons-logging相同,slf4j也是一个通用的日志接口,在程序中与其他日志框架结合使用,并对外提供服务. Simple Logging Facade for Java简称 ...
- svn clearup svn cleanup failed–previous operation has not finished; run cleanup if it was int错误的解决办法
今天svn提交,出现异常:svn cleanup failed–previous operation has not finished; run cleanup if it was interrupt ...