什么是 Nacos
Nacos 是一个微服务管理平台,支持几乎所有主流类型的“服务”的发现、配置和管理。
什么是Dubbo
Dubbo是一款高性能、轻量级的开源Java RPC框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。
Maven依赖
1 | <!-- Apache Dubbo Begin --> |
配置注册中心
1 | dubbo: |
示例接口与实现
1 | public interface DemoService { |
实现:
1 | "${demo.service.version}") (version = |
消费
1 | "1.0.0") (version = |
接口和实现可以拆分成不同的模块,实现解耦