Tag Archives: 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

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

After upgrading mybatis-plus version from 3.1.2 to 3.4.0, re-running it reported an error

 

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

Analysis: adminmapper is the first mapper in the list. It is speculated that the @mapper annotation is invalid. Try to use the @mapperscan annotation and find that it is running normally (PS, add @mapperscan, and @mapper is not necessary)

@MapperScan("com.course.mapper")