Spring+Mybatis整合报错Mapped Statements collection does not contain value原因之一
报错如下:
### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxx.entity.UserMapper.insert
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxx.entity.UserMapper.insert
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy10.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240)
可能的原因是:mapperLocations的value值classpath缺少了*号
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描entity目录, 省掉Configuration.xml里的手工配置 -->
<property name="mapperLocations" value="classpath:com/xxx/*/mapper/*.xml" />
</bean>
修改如下:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描entity目录, 省掉Configuration.xml里的手工配置 -->
<property name="mapperLocations" value="classpath*:com/xxx/*/mapper/*.xml" />
</bean>
Spring+Mybatis整合报错Mapped Statements collection does not contain value原因之一的更多相关文章
- Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value
问题一: mybatisPlus完全兼容mybatis,一般来说直接替换掉就可以了,如果mybatis的数据源不能取消创建的话,就注掉mybatisplus的数据源 //@Configurationp ...
- mybatis启动报错Mapped Statements collection already contains value for com.autoyol.mapper.trans.TransDispatchingMapper解决
1.检查sqlsession配置,在applicationContext文件中.检查mybatis配置文件. 2.检查TransDispatchingMapper.java 是接口类,无注解. 3.T ...
- mybatis报错Mapped Statements collection does not contain value for com.inter.IOper
首页 > 精品文库 > mybatis报错Mapped Statements collection does not contain value for com.inter.IOper m ...
- 报错Mapped Statements collection does not contain value for com.atguigu.mybatis.dao.EmployeeMapperPlus
报错Mapped Statements collection does not contain value for com.atguigu.mybatis.dao.EmployeeMapperPlus ...
- Mybatis报错——Mapped Statements collection already contains value for
解决办法: 看看你的mybatis-config.xml <mappers> <mapper resource="mapper/SeckillDao.xml&quo ...
- spring和mybatis整合报错:org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyExceptio ...
- mybatis启动报错Result Maps collection already contains value forxxx
ssm搭建过程中启动tomcat,报错: Cause: java.lang.IllegalArgumentException: Result Maps collection already conta ...
- SpringBoot和mybatis整合报错:Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 152; columnNumber: 10; 元素类型为 "mapper"
很明显,报错是xml有问题,于是去检查,发现: 由于粗心,保存的时候,按的太频繁,多按了个s在里面,导致启动报错!
- Spring+Mybatis+Dubbo报错java.lang.reflect.MalformedParameterizedTypeException
原因是spring的jar文件冲突,排除spring的文件即可 <dependency> <groupId>com.alibaba</groupId> <ar ...
随机推荐
- tomcat的部署
零.服务器.Servlet容器.web容器 Servlet容器:能够运行Servlet的环境叫做Servlet容器 web容器:能够运行web应用的环境就叫做web容器 weblogic websph ...
- 30天,APP创业从0到1【7.11郑州站】
活动概况 时间:2015年07月11日13:30-16:30 地点:慧谷咖啡(郑州杨金路9号河南外包产业园天元W栋) 主办:APICloud.环信.河南中医药大学医药信息化实验室 网址:www.api ...
- 最新AndroidSDK安装教程
很多人都有安卓sdk安装的疑问,现在我就将步骤详细的介绍,那就直接进入正题吧. 工具/原料 Android SDK 方法/步骤 下载最新的Android SDK 文件,到官网选择自己想要的 ...
- Could not find class XXX referenced from method XXX.<YYY>
Since some ADT-Version you have to set which libraries / projects should be exported too. Project-Pr ...
- 深入理解CSS3 Animation 帧动画 ( steps )
作者:Aaron的博客 网址:http://www.cnblogs.com/aaronjs/p/4642015.html --------------------------------------- ...
- 将 IDENTITY 转换为数据类型 int 时出现算术溢出错误。
IDENTITY标识列为int类型,取值范围为-2^32到2^31-1.当增长值超过这个最大值时,我在SQL Server 2008 R2 x64上试验的结果是: 将 IDENTITY 转换为数据类型 ...
- Java数据类型和对象的引用
在Java中,变量分为两类: 1.基本类型变量,java是传递的副本 2.一切对象型变量,传引用副本的实质是复制指向地址的指针 a.基本类型引用 public class BasicTransmit ...
- node.js学习(1)
新建便笺 3 node.js学习(1) 1)安装 http://nodejs.org/download/下载. 2)编写一个案例 var http=require("http"); ...
- Swift实战-豆瓣电台(四)歌曲列表的展现
观看地址 http://v.youku.com/v_show/id_XNzMwNDE0OTA4.html 这节的主要内容是如何利用cell展现获取到的数据. 首先申明两个数组来储存我们获取到的数据 v ...
- postgres-toolkit (A Victorinox for PostgreSQL DBA )
postgres-toolkit A collection of scripts and utilities to manage PostgreSQL servers. Allows DBA to p ...