问题遇到的现象和发生背景
springboot注入失败
问题相关代码,请勿粘贴截图
@Autowired
private ToBrailleImpl toBrailleImpl;
service层有接口类和实现类,在controller层注入接口类就报错找不到依赖,而注入实现类就不报错
运行结果及报错内容
@Autowired
private ToBrailleMsgInterface toBraille;
报错:
Description:
Field toBraille in tobraille1.controller.ToBraille required a bean of type 'tobraille1.service.serviceInterface.ToBrailleMsgInterface' 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 'tobraille1.service.serviceInterface.ToBrailleMsgInterface' in your configuration.