天天看点

记录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 引用时名字不一致,一个是大写,一个是小写。导入无法引用到。

改为统一名字就行了。