报错Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.yang.service.DictService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
今天在做一个关于dubbo分布式服务框架的案例,在写controller时,注入Service层习惯性用了@Autowired,但是使用了dubbo之后应该用@Reference(com.alibaba.dubbo.config.annotation.Reference)来实现自动注入。
@Autowired
private DictService dictService;
修改为
@Reference
private DictService dictService;
即可。