报错如下:

### 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原因之一的更多相关文章

  1. Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value

    问题一: mybatisPlus完全兼容mybatis,一般来说直接替换掉就可以了,如果mybatis的数据源不能取消创建的话,就注掉mybatisplus的数据源 //@Configurationp ...

  2. mybatis启动报错Mapped Statements collection already contains value for com.autoyol.mapper.trans.TransDispatchingMapper解决

    1.检查sqlsession配置,在applicationContext文件中.检查mybatis配置文件. 2.检查TransDispatchingMapper.java 是接口类,无注解. 3.T ...

  3. 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 ...

  4. 报错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 ...

  5. Mybatis报错——Mapped Statements collection already contains value for

    解决办法: 看看你的mybatis-config.xml <mappers>     <mapper resource="mapper/SeckillDao.xml&quo ...

  6. 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 ...

  7. mybatis启动报错Result Maps collection already contains value forxxx

    ssm搭建过程中启动tomcat,报错: Cause: java.lang.IllegalArgumentException: Result Maps collection already conta ...

  8. 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在里面,导致启动报错!

  9. Spring+Mybatis+Dubbo报错java.lang.reflect.MalformedParameterizedTypeException

    原因是spring的jar文件冲突,排除spring的文件即可 <dependency> <groupId>com.alibaba</groupId> <ar ...

随机推荐

  1. QMainWindow的setLayout的问题

    因为QMainWindow有自己的layout,所以需要一个QWidget,然后setCentralWidget,给这个QWidget调用setLayout http://stackoverflow. ...

  2. IEnumerable和IQueryable的区别

    转自:http://www.cnblogs.com/fly_dragon/archive/2011/02/21/1959933.html IEnumerable接口 公开枚举器,该枚举器支持在指定类型 ...

  3. Linux命令行–理解Linux文件权限(转)

    6.1.1 /etc/passwd文件 /etc/passwd:包含系统用户账户列表以及每个用户的基本配置信息 每个条目有七个字段,每个字段用冒号隔开 登录用户名 用户密码 用户账户的UID 用户账户 ...

  4. 基础拾掇之——http基础

    基础拾掇之——http基础 http协议介绍 http:Hyper Text Transfer Protocol 超文本传输协议,是互联网应用最为广泛的一种网络协议,主要用于Web服务.通过计算机处理 ...

  5. frame与bounds的区别

    原来你M,frame.size和bounds.size不总是一样的 在UIViewController的- (void)willAnimateRotationToInterfaceOrientatio ...

  6. ios数字转emoj表情

    +(NSString *)convertSimpleUnicodeStr:(NSString *)inputStr{ ,); UTF32Char inputChar = ; // unicodeInt ...

  7. 解决download.msdn.microsoft.com无法正确解析而无法下载的问题

    不知何时,微软 MSDN 订阅软件下载服务IP解析有问题,总是在点击“下载”按钮之后无法打开. 想必又跟“国情”有关,我是使用联通宽带,没测试过电信的. 我是可以通过指定hosts entry来解决: ...

  8. Android中ScrollView嵌套GridView,解决GridView显示不全的问题

    /** * 自定义gridview,解决ScrollView中嵌套gridview显示不正常的问题(1行半) * */ public class MyGridView extends GridView ...

  9. 支持正则或通配符的hashmap

    RegexpKeyedMap http://wiki.apache.org/jakarta/RegexpKeyedMap RegexHashMap https://heideltime.googlec ...

  10. 【转】线程、Thread类和线程终止

    一.线程Thread启动 0. Thread类实现了java.lang.Runnable接口,即实现了run方法.虽然在Sun JDK中,start()调用了start0()方法,start0()方法 ...