dubbo消费者怎么配置包路径
来源:5-4 测试集群角色以及选举

qq_君君晨晨_0
2021-03-15
我已经配置好了生产者,如下图所示
我想在消费端调用这个服务,但是显示找不到服务,提示如下:
No provider available for the service com.bnuz.yjpj.datastatistics.service.CourseStatisticsService
说找不到服务com.bnuz.yjpj.datastatistics.service.CourseStatisticsService
我对比了一下,发现是包路径不对,我该怎样在消费者中配置包路径以确保它们俩能一样?找了半天找不到在哪里配置包路径
下面是消费者代码
package com.bnuz.yjpj.datastatistics.web;
import com.bnuz.yjpj.common.dto.DataReturnDto;
import com.bnuz.yjpj.datastatistics.service.CourseStatisticsService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 数据统计-课程统计
*
* @author ZhangChen
**/
@RestController
@RequestMapping("/api/CourseStatistics")
public class SubjectStatistics {
@DubboReference
CourseStatisticsService courseStatisticsService;
@RequestMapping("/getClassSubjectStatistics")
public DataReturnDto getClassSubjectStatistics(String classId, Integer week, String teacherId){
DataReturnDto classSubjectStatistics = courseStatisticsService.getClassSubjectStatistics(classId, week, teacherId);
return classSubjectStatistics;
}
}
按照生产者路径在消费者中建立了对应的包路径就调用成功了
写回答
1回答
-
猜测你的项目出了配置问题,应该是哪里的细节没有注意噢~
现在基本上很少有项目用dubbo开发了额~~032021-03-15
相似问题