这个异常是IDEA中漏加载mapper.xml文件,在classes中没找到,所以要在配置文件中加入:
!--如果不添加此节点mybatis的mapper.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>