Spring Boot/Cloud+Nacos+Dubbo integration example

Actually I am the true temperament 2022-09-23 10:19:28 阅读数:672



Recently, I was reading about nacos, spring cloud, dubbo and other microservices related things. I built a set of environment by myself. After I finished writing it, I was a bit stunned to read the online posts. There are actually various ways of writing.So I decided to try all three methods, feel the difference, and talk about the pits.
Fortunately, I have run through all 3 examples.

Environmental Setup:

Nacos 1.3.1 The highest version when I downloaded was 1.3.2
I used the release version directly, I compiled it myself without downloading the source code
Version download address:https://github.com/alibaba/nacos/releases
I downloaded this: https://github.com/alibaba/nacos/releases/download/1.3.1/nacos-server-1.3.1.zip
Decompression and startup processes are available on the official website: https://nacos.io/
I clicked a stand-alone version startup.sh -m standalone
I really don’t have the address and account password after startupFound on the official website, home page:
http://your IP address: 8848/nacos/
account, password is nacos
Insert image description here
It's probably like this after entering.Enter the topic below

A total of 3 integration methods are summarized here

The three methods are basically the same, and the annotations are similar, mainly because of different dependencies.Others are basically the same, there may be some pits in it, I will talk about it.

The first: Nacos+Spring Boot+Dubbo native

There are a lot of things, 3 ways to put them in 3 posts

The second: Nacos+dubbo-spring-boot-starter


Third: Nacos+spring-cloud-starter-dubbo



The example already has dependencies on pom.xml, configuration application.properties, and all the source code.
All my code is in one project, including 4 groups of modules, each of which is 4 examples, one of which is not dubbo, but the registry uses nacos, and my development tool is IDEA

  1. Native example of Spring Cloud
    Registry center nacos,
    rebbion load balancing, but this does not seem to be referenced, it may not be seen that it is used
    openFegin, this is used to write an interface
    The module names are consumer-demo and provider-demo
  2. Example 1, Dubbo native
    provider-dubbo-demo and consumer-dubbo-demo
  3. Example 2, dubbo-spring-boot-starter
    dubbo-starter-provider-demo and dubbo-starter-consumer-demo
  4. Example 3 spring-cloud-starter-dubbo
    spring-cloud-alibaba-dubbo-provider and spring-cloud-alibaba-dubbo-consumer

I zip the whole project and threw it on CSDN download, address

copyright:author[Actually I am the true temperament],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/266/202209231010446916.html