edit-icon download-icon

Prerequisites

Last Updated: Jun 21, 2018

Steps for using the Spring Cloud ACM SDK are as follows.

  1. Add Maven dependency.

    1. <dependency>
    2. <groupId>com.alibaba.cloud</groupId>
    3. <artifactId>spring-cloud-starter-acm</artifactId>
    4. <version>1.0.7</version>
    5. </dependency>
  2. Configure the application name and the application group.

    Configure application.properties in Spring Boot, and configure spring.application.group and spring.application.name:

    1. spring.application.group=com.alibaba.cloud.acm
    2. spring.application.name=sample-app
  3. Configure the ACM environment and authentication information.

    Configure application.properties in Spring Boot, and configure alibaba.acm.endpoint, alibaba.acm.namespace, alibaba.acm.accessKey, and alibaba.acm.secretKey:

    1. spring.application.group=com.alibaba.cloud.acm
    2. spring.application.name=sample-app
    3. alibaba.acm.endpoint=xxx
    4. alibaba.acm.namespace=xxx
    5. # Access ACM with instance RAM role
    6. # alibaba.acm.ramRoleName=xxx
    7. alibaba.acm.accessKey=xxx
    8. alibaba.acm.secretKey=xxx
  4. Add application configuration in the ACM console.

    Log on to the ACM console and create a new configuration under the corresponding namespace.

    • Write the Data ID in the following format:

      ${spring.application.group}:${spring.application.name}.properties

      For example: com.alibaba.cloud.acm:sample-app.properties

    • Select TEXT as the configuration format, and enter the key-value pairs to be injected into the application:

      1. user.id = 001
      2. user.name = juven2
      3. user.age = 88

Notes

  • Spring-Cloud-Starter-ACM 1.0.7 and higher version now supports Spring Boot 2.x.
  • We recommend that you use Spring Boot 2.x of 2.0.1.RELEASE and higher version. 2.0.0.RELEASE version has a known bug of reading old data.
Thank you! We've received your feedback.