All Products
Search
Document Center

Enterprise Distributed Application Service:Manage application configurations

Last Updated:Mar 10, 2026

Spring Cloud applications use Nacos for configuration management during local development. After you deploy to Enterprise Distributed Application Service (EDAS), Application Configuration Management (ACM) integrated with EDAS takes over configuration management and push automatically.

This tutorial walks through building a Spring Cloud application with Spring Cloud Alibaba Nacos Config:

  1. Start Nacos Server locally and create a configuration

  2. Build a Spring Boot application that reads from Nacos

  3. Verify dynamic configuration refresh

  4. Deploy the application to EDAS

To skip the build steps, download the nacos-config-example.zip demo project.

Note
  • Spring Cloud Alibaba Nacos Config integrates Nacos with the Spring Cloud framework and follows the Spring Cloud configuration injection specification.

  • The EDAS configuration management feature does not conflict with open source Nacos.

Prerequisites

Before you begin, ensure that you have:

  • Maven installed and configured in your system PATH

  • The latest Nacos Server release downloaded

Step 1: Start Nacos Server

  1. Extract the downloaded Nacos Server archive.

  2. Navigate to the nacos/bin directory and start the server in standalone mode:

    • Linux, UNIX, or macOS:

      sh startup.sh -m standalone
    • Windows:

      startup.cmd -m standalone

Note

By default, startup.cmd launches in cluster mode. Double-clicking the file directly on Windows causes startup to fail. Either run the command above or add MODE="standalone" to startup.cmd. For details, see Nacos quick start.

Step 2: Create a local configuration

  1. Open the Nacos Server console at http://127.0.0.1:8848/nacos. The default username and password are both nacos.

  2. In the left-side navigation pane, choose ConfigManagement > Configurations.

  3. Click the Add icon icon in the upper-right corner to create a configuration.

  4. On the Create Configuration page, set the following parameters and click Publish:

    ParameterValue
    Data IDnacos-config-example.properties
    GroupDEFAULT_GROUP
    FormatProperties
    Configuration Contenttest.name=nacos-config-test

How the Data ID maps to your application

The Data ID follows this naming convention:

${prefix}-${spring.profiles.active}.${file-extension}
ComponentDefaultOverride property
prefixValue of spring.application.namespring.cloud.nacos.config.prefix
spring.profiles.activeCurrent Spring profile. When empty, the hyphen is omitted: ${prefix}.${file-extension}--
file-extensionpropertiesspring.cloud.nacos.config.file-extension. Supported formats: properties, yaml, yml

In this tutorial, the application name is nacos-config-example with no active profile, so the Data ID is nacos-config-example.properties.

Step 3: Build the Spring Boot application

3a. Create a Maven project

Create a Maven project named nacos-config-example.

3b. Add dependencies

Add the following to pom.xml. This example uses Spring Boot 2.1.4.RELEASE with Spring Cloud Greenwich.SR1:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
    <relativePath/>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        <version>2.1.1.RELEASE</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Greenwich.SR1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Version compatibility

Match the Spring Cloud Alibaba version to your Spring Cloud release train:

Spring Cloud release trainSpring Cloud Alibaba version
Greenwich2.1.1.RELEASE
Finchley2.0.1.RELEASE
~~Edgware~~~~1.5.1.RELEASE~~ (discontinued -- do not use)

3c. Create the startup class

Under src/main/java, create the package com.aliware.edas and add the following NacosConfigExampleApplication class:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class NacosConfigExampleApplication {
    public static void main(String[] args) {
        SpringApplication.run(NacosConfigExampleApplication.class, args);
    }
}

3d. Create a controller

In the same package, create an EchoController class. The @RefreshScope annotation enables dynamic configuration refresh: when test.name changes in Nacos, the application picks up the new value without a restart.

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class EchoController {

    @Value("${test.name}")
    private String userName;

    @RequestMapping(value = "/")
    public String echo() {
        return userName;
    }
}
Note

@RefreshScope recreates the bean when Nacos pushes a configuration change. The auto-refresh listener is enabled by default (spring.cloud.nacos.config.refresh.enabled=true).

3e. Configure the Nacos Server address

Under src/main/resources, create a bootstrap.properties file:

spring.application.name=nacos-config-example
server.port=18081
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
  • 127.0.0.1:8848 -- the Nacos Server address.

  • 18081 -- the application port.

If Nacos Server runs on a different machine, update the address and port. See Configuration reference for additional properties.

Step 4: Run and verify locally

Verify the initial configuration

  1. Run the main method in NacosConfigExampleApplication to start the application.

  2. Open http://127.0.0.1:18081 in a browser. The response is nacos-config-test -- the value of test.name that you set in Step 2.

Verify dynamic configuration refresh

  1. In the Nacos Server console, go to ConfigManagement > Configurations and edit the nacos-config-example.properties entry.

  2. Change test.name=nacos-config-test to test.name=nacos-config-updated and click Publish.

  3. Refresh http://127.0.0.1:18081. The response now shows nacos-config-updated, confirming that @RefreshScope works without an application restart.

Step 5: Deploy to EDAS

Recreate the same configuration in EDAS before deploying, so the application can read it from the EDAS configuration management module.

5a. Create the configuration in EDAS

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Microservice Configurations.

  3. On the Configurations page, select a Region in the top navigation bar and a Microservices Namespace from the dropdown. Then click Create Configuration.

  4. In the Create Configuration panel, set the same parameters as the local Nacos configuration and click Create:

    ParameterValue
    Data IDnacos-config-example.properties
    GroupDEFAULT_GROUP
    FormatProperties
    Configuration Contenttest.name=nacos-config-test
Note

The Region and Microservice Namespace values are inherited from the Configurations page and cannot be changed in this panel.

5b. Deploy the application

Deploy the application to EDAS. Choose a deployment method based on your infrastructure:

Streamline local-to-cloud development

After your application runs on EDAS, you can skip the local Nacos Server setup for subsequent iterations. EDAS provides a local-to-cloud interconnection feature that lets a locally running application:

  • Read configurations directly from the EDAS configuration management module

  • Call other cloud-deployed applications and receive calls from them

This gives you the full EDAS runtime behavior without redeploying for every change.

Configuration reference

Add any of these properties to bootstrap.properties to customize Nacos Config behavior:

Configuration itemKeyDefaultDescription
Server addressspring.cloud.nacos.config.server-addr--Nacos Server address (required)
Data ID prefixspring.cloud.nacos.config.prefix${spring.application.name}Prefix portion of the Data ID
Groupspring.cloud.nacos.config.groupDEFAULT_GROUPConfiguration group
Data ID suffix and formatspring.cloud.nacos.config.file-extensionpropertiesFile format for the configuration content. Supported: properties, yaml, yml
Encodingspring.cloud.nacos.config.encodeUTF-8Character encoding for configuration content
Timeoutspring.cloud.nacos.config.timeout3000Timeout for fetching configurations, in milliseconds
Namespacespring.cloud.nacos.config.namespace--Isolate configurations across environments (development, test, production)
Context pathspring.cloud.nacos.config.context-path--Relative path of the Nacos Server API
Endpointspring.cloud.nacos.config.endpointUTF-8Region-specific endpoint for dynamic server address resolution
Auto-refreshspring.cloud.nacos.config.refresh.enabledtrueEnable or disable the configuration change listener

For the full list of configuration items, see the Spring Cloud Alibaba Nacos Config documentation.