错误: Invalid bound statement (not found): com.hanfei.Auth.mapper.SysMenuMapper.findMenuListByUserId
原因:出现这种错误,一般情况下是xml文件出错。
第一种情况:.xml文件未按要求格式书写
检查自己的xml文件,看看是不是写错了
第二种情况:如果使用maven则要注意Maven默认加载src-java-main 目录下的.java文件 ,xml在main目录下导致没有被加载。
解决办法:
1,把xml文件移到resources中。
2,在pom.xml文件下添加如下配置
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes> <include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
并在配置文件中告诉你的.xml文件所在位置
以下是在springboot框架下的,yml配置文件中的配置。
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:com/hanfei/Auth/mapper/xml/*.xml
当出现Invalidboundstatement:notfound错误时,通常是由于xml文件配置不正确导致。检查SysMenuMapper的.xml文件,确保其格式无误。如果使用Maven,可能是因为xml文件不在正确目录下。解决方案包括将.xml移动到resources目录,或者在pom.xml中配置资源路径,同时在Springboot的yml配置文件中指定mapper-locations。
2309

被折叠的 条评论
为什么被折叠?



