当前位置:   article > 正文

springboot整合Mybatis提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)_spring 配置mybatis org.apache.ibatis.binding.binding

spring 配置mybatis org.apache.ibatis.binding.bindingexception: invalid bound

springboot整合Mybatis提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

解决方案
1.首先在pom.xml中,将xxxmapper.xml添加到类路径


  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <targetPath>${basedir}/target/classes/com/hgh/springcloud/admin/dao</targetPath>
        <directory>src/main/java/com/hgh/springcloud/admin/dao</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.xml</include>
        </includes>
      </resource>
    </resources>

  </build>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

2.在配置文件中,指定mapper文件所在路径
#mybatis的配置文件

mybatis.config-location=classpath:/mybatis-config.xml
mybatis.mapper-locations=classpath:**/dao/**.xml
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/158279
推荐阅读
相关标签
  

闽ICP备14008679号