SpringBoot:Invalid bound statement (not found)的原因和解决方案

简介: SpringBoot:Invalid bound statement (not found)的原因和解决方案

🐓 报错信息:

(无效绑定声明)找不到

image.png

解析:

你的mapper实例对象和对应的mapper.xml对象未找到


🐓 排查:

情况一:

1.排除相对应的mapper实例对象路径是否正确

1278d8a05c5844788c7b32532c3209c5.png

查看相对应的mapper中的接口是否添加了@mapper注解且点击其跳转标志确认是否关联

f38f56c2311f436db77d4c871afe92c7.png

2.如果无法跳转,说明其mapper.xml和mapper实例对象路径可能绑定错误,导致的Invalid bound statement

768f2b68d77c4a54aed9c52dcced47e9.png

3.检查 mapper namespace的路径是否和其mapper实例类的路径是否一致

be33f56b886444b7881737ff2ed8bfaa.png

情况二:

application.properties文件问题

mybatis.mapper-locations=classpath:/priv/zhengfa/mapper/*.xml


情况三:

启动类扫描未扫到

@SpringBootApplication
@MapperScan("路径.mapper")
public class Application {
 
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }
 
}


情况四:mapper.xml未放到指定的resource文件中,将其移动至其文件即可

b0a82c622acd4ed094e175bd6fa61b7e.png

目录
打赏
0
1
1
0
23
分享
相关文章
【Azure Developer】Springboot 集成 中国区的Key Vault 报错 AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found
【Azure Developer】Springboot 集成 中国区的Key Vault 报错 AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found
|
9月前
|
Spring Boot启动失败问题:hile scanning for the next token found character '@'
Spring Boot启动失败问题:hile scanning for the next token found character '@'
422 0
springboot3 解决:Could not autowire. No beans of ‘JavaMailSender‘ type found
因为 spring-boot-starter-mail 默认使用某些包发生了变化,在 2.2.xx 版本前后不一,解决对应bug
557 0
springboot之log4j:WARN No appenders could be found for logger
springboot之log4j:WARN No appenders could be found for logger
springboot之log4j:WARN No appenders could be found for logger
idea springboot无法自动装配Could not autowire. No beans of ‘Xxx‘ type found.
idea springboot无法自动装配Could not autowire. No beans of ‘Xxx‘ type found.
idea springboot无法自动装配Could not autowire. No beans of ‘Xxx‘ type found.
spring boot Configuration Annotation Proessor not found in classpath(贼简单)
spring boot Configuration Annotation Proessor not found in classpath(贼简单)
springboot整合mybatis中:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
在项目的启动过程中如果出现:以下报错信息,则可以从以下几个方面入手排查问题。 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上,需要比较细致的对比,这是第二次出现这种异常。我每次都是按照如下方法去逐一排查的,到最后都能解决问题。
848 0
SpringBoot项目出现: Invalid bound statement (not found)可能原因
SpringBoot项目出现: Invalid bound statement (not found)可能原因
268 0
SpringBoot项目出现: Invalid bound statement (not found)可能原因
基于SpringBoot+Vue实现的留守儿童爱心网站设计与实现(计算机毕设项目实战+源码+文档)
博主是一位全网粉丝超过100万的CSDN特邀作者、博客专家,专注于Java、Python、PHP等技术领域。提供SpringBoot、Vue、HTML、Uniapp、PHP、Python、NodeJS、爬虫、数据可视化等技术服务,涵盖免费选题、功能设计、开题报告、论文辅导、答辩PPT等。系统采用SpringBoot后端框架和Vue前端框架,确保高效开发与良好用户体验。所有代码由博主亲自开发,并提供全程录音录屏讲解服务,保障学习效果。欢迎点赞、收藏、关注、评论,获取更多精品案例源码。
82 10
基于SpringBoot+Vue实现的家政服务管理平台设计与实现(计算机毕设项目实战+源码+文档)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
63 8
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等