Field adminMapper in com.course.service.impl.AdminServiceImpl required a bean of type 'com.course.mapper.AdminMapper' that could not be found

Field adminMapper in com.course.service.impl.AdminServiceImpl required a bean of type 'com.course.mapper.AdminMapper' that could not be found.

mybatis-plus版本由3.1.2升级至3.4.0后,重新运行就报了错了

2021-10-30 16:47:03.148 ERROR 17576 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 
***************************
APPLICATION FAILED TO START
***************************
Description:

Field adminMapper in com.course.service.impl.AdminServiceImpl required a bean of type 'com.course.mapper.AdminMapper' that could not be found.

Action:
Consider defining a bean of type 'com.course.mapper.AdminMapper' in your configuration.
Process finished with exit code 0

分析一下: adminMapper是列表中最先的一个mapper, 推测 @Mapper注解失效 ,尝试使用@MapperScan注解,发现正常运行了(PS,加了@MapperScan,@Mapper就没必要了)

@MapperScan("com.course.mapper")
posted @ 2021-10-30 20:02  YueQAQ  阅读(1186)  评论(0编辑  收藏  举报