invalid bound statement (not found)

mybatis代码生成器生成的mapper类,在service中使用@Autowired报错 Could not autowire. No beans of 'AccountMapper' type found.

直接运行代码,接口访问报错

查询后,知道需要在pom.xml文件中的<build>中配置了resource,不然mapper.xml文件就会被漏掉

<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>
原文地址:https://www.cnblogs.com/tianphone/p/10756010.html