控制台报错:
Description:
Field userMapper in cn.dingyi.controller.UserController required a bean of type 'cn.dingyi.mapper.UserMapper' that could not be found.
Action:
Consider defining a bean of type 'cn.dingyi.mapper.UserMapper' in your configuration.
报错原因:扫描不到这个包
解决:
在启动类的类名上方加入这个包的路径:@MapperScan(basePackages = "cn.dingyi.mapper")
还需要在pom.xml文件中添加build 标记和里面的内容:
<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>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>