Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
最近在使用Maven+SSM整合开发分模块分布式的时候,出现了以下的错误

判断是找不到xml文件
1.检查target

mapper.xml未被漏掉
注:需在pom.xml中添加过滤以防xml被漏
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
2.检查mybatis-config.xml
问题出在mappers标签
<mappers>
<mapper class="com.kuang.dao.BookMapper"/>
</mappers>
当接口和xml同名时可用mapper class配置
而当接口和xml不同命时
应用mapper resource配置
修正为
<mappers>
<mapper resource="com/kuang/dao/Mapper.xml"/>
</mappers>
问题成功解决

浙公网安备 33010602011771号