分析原因
如下图,因为idea默认只会扫描resources目录下xml的文件,所有java目录下ItemsMapper.xml没有被扫描到,导致Invalid bound statement (not found): com.test.mapper.ItemsMapper.selectItems
解决办法
在pom文件中,增加一下配置
<resources>
<resource>
<!-- 将Mapper的映射文件拷贝出来 -->
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>