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

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

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 invalid bound statement (not 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>
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄