记录A component required a bean named ‘studentService‘ that could not be found.

2022-04-13 14:43:05 浏览数 (1)

报错如题: A component required a bean named 'studentService' that could not be found.

出问题的代码行:

代码语言:javascript复制
    <dubbo:service layer="biz" interface="com.service.rpc.api.StudentService" ref="studentService" protocol="dubbo" group="xmlConfig"/>

出错的地方:

代码语言:javascript复制
ref="studentService"  

出错原因:报错时在service实现类上注解写的是

代码语言:javascript复制
@Service("StudentService")
代码语言:javascript复制
@Service("StudentService")
public class StudentServiceImpl implements StudentService {

如上代码和 dubbo 引用时名字不一致,一个是大写,一个是小写。导入无法引用到。

改为统一名字就行了。

0 人点赞