天天看點

記錄A component required a bean named ‘studentService‘ that could not be found.

報錯如題: A component required a bean named 'studentService' that could not be found.

出問題的代碼行:

<dubbo:service layer="biz" interface="com.service.rpc.api.StudentService" ref="studentService" protocol="dubbo" group="xmlConfig"/>           

複制

出錯的地方:

ref="studentService"             

複制

出錯原因:報錯時在service實作類上注解寫的是

@Service("StudentService")           

複制

@Service("StudentService")
public class StudentServiceImpl implements StudentService {           

複制

如上代碼和 dubbo 引用時名字不一緻,一個是大寫,一個是小寫。導入無法引用到。

改為統一名字就行了。