解决Springboot报错:Field xx in xx required a bean of type 'xx' that could not be found.

技术栈:Springboot+mybatis

完整报错提示:

Description:

Field usualService in com.sxdt.order.food.usualParts.controller.UsualController required a bean of type 'com.sxdt.order.food.usualParts.service.UsualService' 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.sxdt.order.food.usualParts.service.UsualService' in your configuration.

解决方法:添加注解

解决Springboot报错:Field xx in xx required a bean of type 'xx' that could not be found._第1张图片

如果是DAO的问题,就在dao类前添加  @Mapper

解决Springboot报错:Field xx in xx required a bean of type 'xx' that could not be found._第2张图片

效果如下:

解决Springboot报错:Field xx in xx required a bean of type 'xx' that could not be found._第3张图片

 

 

 

你可能感兴趣的:(Spring,Boot,MyBatis)