Code optimization

pull/2551/head
lixiaoshuang 3 years ago
parent 8e2a41e9ad
commit 857e1096b4

@ -80,7 +80,7 @@
#### 验证自动注入
在浏览器地址栏输入 `http://127.0.0.1:18084/nacos/bean`,并点击调转,可以看到成功从 Nacos Config Server 中获取了数据。
![](https://tva1.sinaimg.cn/large/e6c9d24ely1h29htdsg18j20jc0aigma.jpg)
![get](https://tva1.sinaimg.cn/large/e6c9d24ely1h29htdsg18j20jc0aigma.jpg)
#### 验证动态刷新
1. 执行如下命令,修改 Nacos Server 端的配置数据
@ -89,7 +89,7 @@
2. 在浏览器地址栏输入 `http://127.0.0.1:18084/nacos/bean`,并点击调转,可以看到应用从 Nacos Server 中获取了最新的数据group 变成了 DEFAULT_GROUP。
![](https://tva1.sinaimg.cn/large/e6c9d24ely1h29hzf0ic4j20ks0b4mxy.jpg)
![refresh](https://tva1.sinaimg.cn/large/e6c9d24ely1h29hzf0ic4j20ks0b4mxy.jpg)
## 原理

@ -82,7 +82,7 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl
#### Automatic Injection
Enter `http://127.0.0.1:18084/nacos/bean` in the browser address bar and click Go to, we can see the data successfully obtained from Nacos Config Server.
![](https://tva1.sinaimg.cn/large/e6c9d24ely1h29htdsg18j20jc0aigma.jpg)
![get](https://tva1.sinaimg.cn/large/e6c9d24ely1h29htdsg18j20jc0aigma.jpg)
#### Dynamic Refresh
1. Run the following command to modify the configuration data on the Nacos Server side.
@ -91,7 +91,7 @@ Enter `http://127.0.0.1:18084/nacos/bean` in the browser address bar and click G
2. Enter `http://127.0.0.1:18084/nacos/bean` in the address bar of the browser, and click Flip, you can see that the application has obtained the latest data from Nacos Server, and the group has become DEFAULT_GROUP.
![](https://tva1.sinaimg.cn/large/e6c9d24ely1h29hzf0ic4j20ks0b4mxy.jpg)
![refresh](https://tva1.sinaimg.cn/large/e6c9d24ely1h29hzf0ic4j20ks0b4mxy.jpg)
## Principle

@ -28,6 +28,7 @@ import com.alibaba.nacos.api.exception.NacosException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@ -27,6 +27,7 @@ import com.alibaba.nacos.api.exception.NacosException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

Loading…
Cancel
Save