Nacos Registry Center

Nacos registry center for dubbo

Nacos is a very important registry center for Dubbo ecosystem, dubbo-registry-nacos is the implementation of Nacos integration to Nacos.

Prepare Work

When you integrate dubbo-registry-nacos into your Dubbo project, please Make sure the Nacos service is started in the background. If you are not familiar with the basic use of Nacos, you can refer to Nacos Quick Start. It is recommended to use the version equal or above Nacos 1.0.0.

Quick Start

The steps for Dubbo to integrate Nacos as a registry center are very simple. The general steps can be divided into “add Maven dependencies” and “configure registry center”.

Add Maven Dependencies

First, you need to add the dubbo-registry-nacos Maven dependency to your project’s pom.xml file, and we strongly recommend that you use Dubbo 2.6.5:


    <!-- Dubbo Nacos registry dependency -->
    <!-- Keep latest Nacos client version -->
    <!-- Dubbo dependency -->
    <!-- Alibaba Spring Context extension -->


When you add dubbo-registry-nacos to your project, you don’t need to explicitly program the service discovery and registration logic. The actual implementation is provided by the three-party package.

Configure Registry Center

Assuming your Dubbo app uses the Spring Framework assembly, there are two configuration options available: Dubbo Spring Externalization Configuration and the Spring XML configuration file.

Dubbo Spring Externalization Configuration

The Dubbo Spring externalization configuration is a new feature introduced by Dubbo 2.5.8 that automatically generates and binds Dubbo configuration beans through the Spring Environment property, simplifying configuration and lowering the microservice development threshold.

Assuming your Nacos Server is also running on server and using the default Nacos service port 8848, you only need to adjust the dubbo.registry.address property as follows:

## Other properties remain unchanged

## Nacos registry address
dubbo.registry.address = nacos://

Then, restart your Dubbo app, Dubbo’s service provider and consumer information can be displayed on the Nacos console:


As shown in the figure, the information whose service name prefix is providers: is the meta information of the service provider, and the consumers: represents the meta information of the service consumer. Click on “Details” to view service status details:


If you are using the Spring XML configuration file to assemble the Dubbo registry, please refer to the next section.

Spring XML Configuration File

Similar to Dubbo Spring Externalization Configuration, just adjust the address attribute to configure:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    <!-- Provider application information for calculating dependencies -->
    <dubbo:application name="dubbo-provider-xml-demo"  />
    <!-- Use Nacos as Registry Center -->
    <dubbo:registry address="nacos://" />

After restarting the Dubbo app, you can also find that the registration meta-information of the service provider and consumer is presented on the Nacos console:


Last modified November 25, 2020: fix sample code issue for (#659) (0576d68)