解决方法 required a bean of type ‘com.example.day14.mapper.deptmapper‘ that could not be found.

项目报错,一直提示
解决方法 required a bean of type ‘com.example.day14.mapper.deptmapper‘ that could not be found.解决方法 required a bean of type ‘com.example.day14.mapper.deptmapper‘ that could not be found.
解决办法:
这个错误得出现主要是因为项目没有扫描到mapper包,@MapperScan 是扫描mapper类的注解。你只需要在项目启动类上加注解 @MapperScan(“Mapper文件所在的包”),,就不用在每个mapper类上加@MapperScan了。

步骤:
1、复制你的mapper包相对路径
解决方法 required a bean of type ‘com.example.day14.mapper.deptmapper‘ that could not be found.

然后粘贴到你的启动类
解决方法 required a bean of type ‘com.example.day14.mapper.deptmapper‘ that could not be found.
再次运行一下就可以了。