Invalid bound statement (not found) 报错

常规的问题都检查了,还是报错。

用mp代码生成器的目录结构如下:
Invalid bound statement (not found) 报错_第1张图片
xml文件没有放在resources路径下

这样会导致xml文件不在target目录下,解决的方式是在pom.xml文件中加入:

<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.yml
                **/*.properties</include>
                <include>**/*.xml
            
            false
        
        
            src/main/resources
            
                **/*.yml</include>
                <include>**/*.properties
                **/*.xml</include>
                <include>**/*.png
            
            false
        
    
    

这样target目录下有xml文件了,仍然报错。

还需要修改配置文件,这个地方排查了好久!!!

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志
  mapper-locations: classpath:com/atguigu/*/mapper/xml/*.xml

解决Mybatis 报错Invalid bound statement (not found)

当xml在resources中mapper对应路径时,不用修改mapper-locations
Invalid bound statement (not found) 报错_第2张图片
mybatis mapper-locations作用

你可能感兴趣的:(Java,#,配置,mybatis)