mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
update example readme nacos port to 8848
This commit is contained in:
@@ -21,7 +21,7 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl
|
||||
|
||||
2. Add Nacos server address configurations to file /src/main/resources/bootstrap.properties
|
||||
|
||||
spring.cloud.nacos.config.server-addr=127.0.0.1:8080
|
||||
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
|
||||
@@ -50,7 +50,7 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl
|
||||
|
||||
3. Execute the following command to add a configuration to Nacos Server.
|
||||
|
||||
curl -X POST "http://127.0.0.1:8080/nacos/v1/cs/configs?dataId=nacos-config-example.properties&group=DEFAULT_GROUP&content=user.id=1%0Auser.name=james%0Auser.age=17"
|
||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos-config-example.properties&group=DEFAULT_GROUP&content=user.id=1%0Auser.name=james%0Auser.age=17"
|
||||
|
||||
**Note: You can also add it in other ways. If you are using the Nacos version with its own console, it is recommended to configure it directly using the console.**
|
||||
|
||||
@@ -89,7 +89,7 @@ Enter `http://127.0.0.1:18084/user` in the browser address bar and click Go to,
|
||||
#### Dynamic Refresh
|
||||
1. Run the following command to modify the configuration data on the Nacos Server side.
|
||||
|
||||
curl -X POST "http://127.0.0.1:8080/nacos/v1/cs/configs?dataId=nacos-config-example.properties&group=DEFAULT_GROUP&content=user.id=1%0Auser.name=james%0Auser.age=18"
|
||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos-config-example.properties&group=DEFAULT_GROUP&content=user.id=1%0Auser.name=james%0Auser.age=18"
|
||||
|
||||
2. Enter `http://127.0.0.1:18084/user` in the browser address bar and click Go to,
|
||||
We can see that the app got the latest data from Nacos Server and the age becomes 18.
|
||||
|
Reference in New Issue
Block a user