0
点赞
收藏
分享

微信扫一扫

SpringBoot集成Dubbo

SDKB英文 2022-03-30 阅读 48
java后端

最近升级了SpringBoot版本发现Dubbo集成方式稍有不同,这里记录一下,以供参考。

SpringBoot 版本1.5.18.RELEASE 升级到2.0.3.RELEASE

第一步: 添加依赖

org.springframework.boot spring-boot-starter-web 1.5.18.RELEASE com.alibaba dubbo 2.6.0 com.101tec zkclient 0.7 org.springframework.boot spring-boot-starter-web 2.0.3.RELEASE com.alibaba.boot dubbo-spring-boot-starter 0.2.0 com.101tec zkclient 0.10

第二步: 添加配置

server.port = 8081
dubbo.application.name = ServiceProvider
dubbo.registry.protocol = zookeeper
dubbo.registry.address = localhost:2181
dubbo.protocol.name = dubbo
dubbo.protocol.port = 20881
dubbo.scan = com.test.base

第三步: 添加注解

启动类:@EnableDubbo
服务提供方:@Service
服务消费方:@Reference

举报

相关推荐

0 条评论