This topic explains how to integrate spring-cloud-starter-alibaba-nacos-config.

Get the Starter

Add the following configuration to the pom.xml file of the Maven project to obtain spring-cloud-starter-alibaba-nacos-config.



  1. Configure the connection and configuration source in The dataId of the configuration source is

    # The value of endpoint and namespace can be found in namespace details.${endpoint}${namespace}
    # We recommend that you use the accessKey and secretKey of the RAM account${accessKey}${secretKey}
    # Specify the configuration extension name, including properties, yaml, and yml, where properties is the default value.
  2. Sets the property value with Spring's @Value annotation. Enable automatic update of configurations with Spring Cloud native annotation @RefreshScope.

    public class ConfigController {
        private int connectTimeoutInMills;
        public void setConnectTimeoutInMills(int connectTimeoutInMills) {
            this.connectTimeoutInMills = connectTimeoutInMills;
        @RequestMapping(value = "/get", method = GET)
        public int get() {
            return connectTimeoutInMills;
  3. Open the ACM console and create a new configuration under the corresponding namespace.

    • Data ID:

    • Select Properties for the configuration format, and put the specific key-value pairs in the configuration body:


    For the complete sample code, see nacos-spring-cloud-config-example.

Related documents