在maven工程下,mybatis的xml文件的错误配置。导致项目报错

错误: 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值