spring boot + mybatis error mapper can not be injected

Startup Problems arise when the project to build a spring boot, first look abnormal segments:

 
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-06-04 09:32:21.462 ERROR 18900 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
 
***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
Field userMapper in com.drefore.demozw.admin.service.TestOneService required a bean of type 'com.drefore.demozw.mapper.UserMapper' that could not be found.
 
The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)
 
 
Action:
 
Consider defining a bean of type 'com.drefore.demozw.mapper.UserMapper' in your configuration.

Tip mapper was not found can not be injected

Internet search around the problem there is that the structure of the project, application should be placed at the entrance class mapper same directory, but the directory structure is not my problem, it may be applicable elsewhere, in which I had to find another way, in the end application add the annotation to solve the problem on the import category

@MapperScan ( "mapper folder path")

Guess you like

Origin www.cnblogs.com/zouwangblog/p/10978798.html