赞
踩
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>
2.在配置文件中,指定mapper文件所在路径
#mybatis的配置文件
mybatis.config-location=classpath:/mybatis-config.xml
mybatis.mapper-locations=classpath:**/dao/**.xml
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。