From e9b99ba547b67e0d07fe2c1bc51a5fcfb2fa3ffb Mon Sep 17 00:00:00 2001 From: flystar32 Date: Mon, 29 Oct 2018 22:20:25 +0800 Subject: [PATCH] update readme of nacos config example --- .../nacos-example/nacos-config-example/readme-zh.md | 9 +++++---- .../nacos-example/nacos-config-example/readme.md | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme-zh.md b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme-zh.md index b9ec18f02..e7339058c 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme-zh.md +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme-zh.md @@ -19,9 +19,10 @@ spring-cloud-starter-alibaba-nacos-config -2. 在应用的 /src/main/resources/bootstrap.properties 配置文件中配置 Nacos Config 地址 +2. 在应用的 /src/main/resources/bootstrap.properties 配置文件中配置 Nacos Config 元数据 - spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + spring.application.name=nacos-config-example + spring.cloud.nacos.config.server-addr=127.0.0.1:8848 3. 完成上述两步后,应用会从 Nacos Config 中获取相应的配置,并添加在 Spring Environment 的 PropertySources 中。这里我们使用 @Value 注解来将对应的配置注入到 SampleController 的 userName 和 age 字段,并添加 @RefreshScope 打开动态刷新功能 @@ -70,8 +71,8 @@ 1. 增加配置,在应用的 /src/main/resources/application.properties 中添加基本配置信息 - spring.application.name=nacos-config-example - server.port=18084 + server.port=18084 + management.endpoints.web.exposure.include=* 2. 启动应用,支持 IDE 直接启动和编译打包后启动。 diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme.md b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme.md index a2f8f3e8f..58b499aef 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme.md +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/readme.md @@ -19,9 +19,10 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl spring-cloud-starter-alibaba-nacos-config -2. Add Nacos server address configurations to file /src/main/resources/bootstrap.properties +2. Add Nacos config metadata configurations to file /src/main/resources/bootstrap.properties - spring.cloud.nacos.config.server-addr=127.0.0.1:8848 + spring.application.name=nacos-config-example + spring.cloud.nacos.config.server-addr=127.0.0.1:8848 3. After completing the above two steps, the application will get the externalized configuration from Nacos Server and put it in the Spring Environment's PropertySources.We use the @Value annotation to inject the corresponding configuration into the userName and age fields of the SampleController, and add @RefreshScope to turn on dynamic refresh . @RefreshScope @@ -70,8 +71,8 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl 1. Add necessary configurations to file /src/main/resources/application.properties - spring.application.name=nacos-config-example - server.port=18084 + server.port=18084 + management.endpoints.web.exposure.include=* 2. Start the application in IDE or by building a fatjar.