mybatis 配置问题查找
mybatis配置问题记录
org.apache.ibatis.binding.BindingException: Type interface com.xx.dao.UserDao(自己项目的文件) is not known to the MapperRegistry.
原因:MapperRegistry顾名思义 mapper没有注册 好比之前servlet学习的时候 每写一个servlet都要注册 此处也是一样 需要到你自己的mybatis核心配置文件中注册
解决办法
<mappers>
<mapper resource="xxx/xx/xx/xx.xml"/>
</mappers>
Cause: java.io.IOException: Could not find resource com/xx/dao/UserDao.xml(自己项目的xml文件)
原因:xx文件没有找到 但是一看项目中是有文件的 且路径也是对的 当文件存在什么都ok的情况下 一般就是配置问题了
maven约定大于配置 一般的文件都是放到resources文件夹下 现在放到java目录下了 可能存在导不出来等问题 解决办法
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
注意点
在Mybatis核心配置文件中注册Mappers时 如果使用<mappers><package name="xx.xxx.xxx"/></mappers>或者<mappers><mapper class="xxx.xxx.xx.xxx"/></mappers>这两种方式
dao接口和xml文件的名称必须一样且必须放在同一个包中
mybatis 配置问题查找的更多相关文章
- mybatis配置问题
//当构造函数有多个参数时,可以使用constructor-arg标签的index属性,index属性的值从0开始. <bean id="sqlSession" class= ...
- Spring与Mybatis配置问题
Spring和Mybatis的整合,主要借助于Spring的依赖注入和控制反转来简化Mybatis的配置,使用两个配置文件[注:此种配置文件网上已经有很多]: spring.xml: <?xml ...
- mybatis 如何查找表里的某一个字段,然后返回它们的结果集list ?
<select id="findArgByParams" resultType="string" parameterType="map" ...
- Eclipse添加快速查找Dao中方法所对应的Mybatis XML映射SQL的插件
Dao关联Mybatis快速查找的插件安装地址:http://dl.bintray.com/harawata/eclipse 安装步骤: ①Eclipse ==> Help ==> Ins ...
- Spring Boot (七)MyBatis代码自动生成和辅助插件
一.简介 1.1 MyBatis Generator介绍 MyBatis Generator 是MyBatis 官方出品的一款,用来自动生成MyBatis的 mapper.dao.entity 的框架 ...
- mybatis <collection>标签 类型为string时无法获取重复数据错误
1.场景: fyq_share_house 表 和 fyq_sh_tag 表 两张表是一对多的关系, 一个楼盘对应多个标签,在实体类ShareHouse中使用 /** * 楼盘标签 */ privat ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案
报错信息: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.study.ser ...
- mybatis错误之配置文件属性配置问题
在mybatis的配置文件SqlMapConfig.xml中,可以在开始的地方先加载一个properties节点,用来定义属性变量. <!-- 加载属性文件 --> <propert ...
- Mybatis+Struts2的结合:实现用户插入和查找
总结一下今天一个成功的小实验:Mybatis+Struts2的结合:实现用户插入和查找.删除和修改如果以后写了,会继续更新. 一 准备工作. 1.新建一个java web项目. 2.在webConte ...
随机推荐
- Java随手记录
Spring @Configuration注解及配置方法 转自:https://www.jb51.net/article/184822.htm Spring @Configuration注解 Spri ...
- JAVA中的clone方法剖析
原文出自:http://blog.csdn.net/shootyou/article/details/3945221 java中也有这么一个概念,它可以让我们很方便的"制造"出一个 ...
- 将VSCode添加至右键菜单(Windows下)
时间:2018-11-09 记录:byzqy 问题: Windows上面安装Visual Studio Code编辑器后,常常会因为安装的时候忘记勾选等原因,没有将"Open with Co ...
- C# - 习题03_分析代码写出结果A.X、B.Y
时间:2017-08-23 整理:byzqy 题目:分析代码,写出程序的输出结果: 文件:Program.cs 1 using System; 2 3 namespace Interview2 4 { ...
- 整型:int
整型:int 整型变量的定义和输出 注意://short<=int<=long<=longlong 代码示例一: #include<stdio.h> int ma ...
- Python之sqlite3模块
python自带有sqlite3模块,该模块可以方便我们操作sqlite数据库,下面一起跟随示例了解sqlite3模块的具体用法. import sqlite3 # 连接数据库 connection ...
- linux系统配置本地yum源
1. 前言 学习Linux系统需要大量的实验,而每次安装系统和准备安装系统后的基础配置比较耗时费力.如果在生产环境中,遇到内网(无法访问互联网)情况下,就需要利用挂载的ISO文件内的Packages中 ...
- MySQL——SQL语句入门
1.DDL: 数据库定义语言 定义对象:库.表 何为定义: 库的定义: 创建 删除 修改---->修改本身以及库中的对象(表.视图.函数.触发器...) 表的定义: 创建---->定义表的 ...
- linux 性能统计命令
命令1 性能压力测试,yes持续输出30s到设备中空文件,然后杀掉进程 { yes> /dev/null & } && sleep 30 && ps -e ...
- Linux内核学习之2号进程kthreadd
Author : Toney Email : vip_13031075266@163.com Date : 2020.12.04 Copyright : ...