什么是dubbo
Dubbo就是资源调度和治理中心的管理工具。
dubbo架构
打开linux虚拟机开启dubbo单机版
创建服务者
点击下一步
消费者同上步骤
服务者的application配置文件
消费者的application配置文件
服务者的service实现类和pom.xml
pom配置
加入 dubbo依赖
消费者的contorller和pom.xml
pom配置 只有dependencies标签中
<dependencies>
<!-- Spring Boot Dubbo 依赖 -->
<dependency>
<groupId>io.dubbo.springboot</groupId>
<artifactId>spring-boot-starter-dubbo</artifactId>
<version>${dubbo-spring-boot}</version>
<!-- 避免依赖冲突,也就是避免阿里巴巴的dubbo中自带的spring依赖跟我们自己添加的依赖产生冲突 -->
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 热部署组件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
项目结构
服务者端
消费者端
测试
简单dome重在理解