大家好,初学者,请问一下为什么我生产端已经在zookeeper上注册成功
但是消费者@reference获取不到接口
端口应该没有错
@EnableDubbo也加了
shopService这个接口下面红线报错找不到, 不过ctrl+左键可以点过去
//配置文件和消费端代码如下
@RestController
public class controller {
@Reference(version="1.0.0",url="dubbo://127.0.0.1:20880")
shopSerice spService;
public void getProvider() {
spService.getDubbo("provider");
}
}
dubbo:
application:
name: springBootConsumer
registry:
address: zookeeper://127.0.0.1:2181
scan:
base-packages: com.example.controller
protocol:
name: dubbo
consumer:
check: false
生产者配置文件和代码:
@Service(version="1.0.0",interfaceClass = shopService.class)
@Component
public class shopServiceImpl implements shopService {..}
dubbo:
application:
name: springBootProvider
registry:
address: zookeeper://127.0.0.1:2181
protocol:
name: dubbo
port: 20880
scan:
base-packages: com.example.service