Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value
【Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value】犀渠玉剑良家子,白马金羁侠少年。这篇文章主要讲述Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value相关的知识,希望能为你提供帮助。
mybatisPlus完全兼容mybatis,一般来说直接替换掉就可以了,如果mybatis的数据源不能取消创建的话,就注掉mybatisplus的数据源
//@Configuration
public class DataSourceConfig {
//@Bean(name="dataSource2")
//@ConfigurationProperties(prefix="spring.datasource")
public DataSource dataSource(){
return new DruidDataSource();
}
// 配置事物管理器
//@Bean(name="transactionManager2")
public DataSourceTransactionManager transactionManager(){
return new DataSourceTransactionManager(dataSource());
}
}
这个时候一般启动就没问题了,但是在调用原来的数据库方法是,可能会报错:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for xx.xxx.xx.listBy
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for xx.xxx.xx.listBy
这个时候看看application.yml中的
mybatis-plus.mapper-locations=classpath:/mybatis/mapper/*.xml路径格式是否正确,与mybatis的mapper路径格式不一样,
mybatis格式为
mybatis.mapperLocations=classpath*:mybatis/mapper/*.xml。。。记一次采坑过程
推荐阅读
- AS新安装Android Studio运行项目前报错(Unable to access Android SDK add-on list)
- AttributeError: ‘_io.TextIOWrapper‘ object has no attribute ‘xreadlines‘
- Android之compileSdkVersionminSdkVersion 以及 targetSdkVersion
- AndroidThe layout "activity_main" in layout has no declaration in the base layout folde
- add application window with unknown token XXX Unable to add window;is your activity is running?(代码片段
- Android 使用Zxing报错(Channel is unrecoverably broken and will be disposed!)
- Mac上查看当前安卓手机上打开的app的包名和主程序入口
- 安卓手机号码自动添加空格效果-终极解决方案-亲测能用
- Android为按钮添加相应事件的代码