Invalid bound statement (not found):
我用的xml文件配置mybatis,出现了一些问题。
首先遇到问题应该一步步检查:
1.导入依赖没
<!-- mybatis 的依赖-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
2.配置扫描没(我用的yml文件):
# 配置映射文件 mybatis: mapper-locations: classpath*:mapper/*Mapper.xml
由于之前将mapper文件命名错误了,导致一直没有扫描到包
所以修改为了:
# 配置映射文件 mybatis: mapper-locations: classpath*:mapper/*.xml
3.添加注解没:
在主类上添加 扫描注解 ,与dao层一样的包名

4.Mapper文件的名称是否正确
<mapper namespace = "com.xxxx.xxx.dao.xxxDao">

浙公网安备 33010602011771号