springboot 整合mybatis的时候报错:dao层bean注入失败

mybatis Field xxxMapper in xxxx required a bean of type 'XXXMapper' that could not be found.

2017-05-11 16:15:32.410 [main] INFO  o.a.catalina.core.StandardService - Stopping service Tomcat 
2017-05-11 16:15:32.457 [main] INFO  o.s.b.a.l.AutoConfigurationReportLoggingInitializer - 
 
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 
2017-05-11 16:15:32.726 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 
 
***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
Field xxxMapper in XXXX required a bean of type 'XXXMapper' that could not be found.
 
 
Action:
 
Consider defining a bean of type 'XXXMapper' in your configuration.
 
 
Process finished with exit code 1
 

原因:springboot加载mybatis的mapper.xml文件时是在resource文件下面,而不是在java下面,更改一下路径

猜你喜欢

转载自blog.csdn.net/qq_38004409/article/details/82800602