org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.ssm.mapper.ItemMapper.selectByExample
从网上查看得知,IDEA正常情况下是无法编译src/main/java目录下的xml文件,我去自己项目的target目录的classes目录下看了,确实没有xml文件。网上说的解决方式之一是,在pom文件中加如下配置:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
我采取的解决方式是:将mybatis的映射文件全部放到resource目录下,且需要保证resource目录下的路径和src/main/java路径下的mybatis的java接口文件所在包路径相同。