一、框架
使用springboot启动,注册中心现在naocs。
nacos安装
二、样例项目
(1)maven设置
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId>
</dependency><dependency><groupId>org.apache.dubbo</groupId><artifactId>dubbo-spring-boot-starter</artifactId><version>2.7.5</version>
</dependency><dependency><groupId>org.apache.dubbo</groupId><artifactId>dubbo-registry-nacos</artifactId><version>2.7.5</version>
</dependency><dependency><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId><version>1.3.3</version>
</dependency>
(2)项目模块
dubbo-inteface dubbo注册接口
class-provider 班级信息提供者
user-provider 用户信息提供者
dubbo-consumer 查询信息消费者
(3)user-provider 配置信息
dubbo:application:name: user-providerregistry:address: nacos://192.168.31.188:8848parameters:namespace: dubbo-serviceconfig-center:namespace: dubbomonitor:protocol: registryprotocol:name: dubboport: 28881logBack:logPathDir: ${logPathDir:./log/${dubbo.application.name}}
更换所有模块的nacos地址和命名空间就可以运行起来
registry:
address: nacos://192.168.31.188:8848
parameters:
namespace: dubbo-service
(4)代码地址
https://github.com/90duc/dubbo-example