解决项目报错:@org.springframework.beans.factory.annotation.Autowired(required=true)

项目使用mybatis,启动时报错:


Description:

Field toolsDetailsService in com.cvit.applet.controller.ToolsDetailsController required a bean of type 'com.cvit.applet.mapper.ToolsDetailsMapper' 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.cvit.applet.mapper.ToolsDetailsMapper' in your configuration.


Process finished with exit code 1
 

原因:

 在ToolsDetailsMapper使用的是@Mapper注解,但是在启动类上使用的是@ComponentScan

解决:

修改启动类上的注解

解决项目报错:@org.springframework.beans.factory.annotation.Autowired(required=true)_第1张图片

项目启动成功!!!!!

你可能感兴趣的:(java,tomcat,开发语言)