From 16ce81e2bc1edb81c03e18de1ae487aa76d9ed06 Mon Sep 17 00:00:00 2001
From: yuluo <1481556636@qq.com>
Date: Sun, 7 Jan 2024 15:07:37 +0800
Subject: [PATCH] feat: update nacos version to 2.3.0 in 2023.x
---
spring-cloud-alibaba-dependencies/pom.xml | 2 +-
.../nacos-example/readme-zh.md | 30 +++++++++----------
.../nacos-example/readme.md | 10 +++----
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml
index e07e8aa865..ae1b5495ef 100644
--- a/spring-cloud-alibaba-dependencies/pom.xml
+++ b/spring-cloud-alibaba-dependencies/pom.xml
@@ -21,7 +21,7 @@
2023.0.0.0
1.8.6
1.8.0
- 2.2.3
+ 2.3.0
1.0.11
4.9.4
diff --git a/spring-cloud-alibaba-examples/nacos-example/readme-zh.md b/spring-cloud-alibaba-examples/nacos-example/readme-zh.md
index 0b82b8cb4d..80bab6a4c1 100644
--- a/spring-cloud-alibaba-examples/nacos-example/readme-zh.md
+++ b/spring-cloud-alibaba-examples/nacos-example/readme-zh.md
@@ -6,26 +6,26 @@
[Nacos](https://github.com/alibaba/Nacos) 是阿里巴巴开源的一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。
-## 正确配置并启动 Nacos Server 2.2.x
+## 正确配置并启动 Nacos Server 2.3.0
-在 Nacos 2.2.x 中,加入了用户鉴权相关的功能,在首次启动 Nacos Server 时,需要正确配置,避免出现启动失败的问题。
+在 Nacos 2.3.0 中,加入了用户鉴权相关的功能,在首次启动 Nacos Server 时,需要正确配置,避免出现启动失败的问题。
### 下载 Nacos Server
-> 本示例中使用 Nacos Server 版本为 2.2.3!
+> 本示例中使用 Nacos Server 版本为 2.3.0!
-Nacos 支持直接下载和源码构建两种方式。**推荐在 Spring Cloud Alibaba 2022.x 中使用 Nacos Server 2.2.3 版本。**
+Nacos 支持直接下载和源码构建两种方式。**推荐在 Spring Cloud Alibaba 2023.x 中使用 Nacos Server 2.3.0 版本。**
1. 直接下载:[Nacos Server 下载页](https://github.com/alibaba/nacos/releases)
2. 源码构建:进入 Nacos [Github 项目页面](https://github.com/alibaba/nacos),将代码 git clone 到本地自行编译打包,[参考文档](https://nacos.io/zh-cn/docs/quick-start.html)。
### 配置 Nacos Server
-打开 `\nacos-server-2.2.3\conf\application.properties` 配置文件,修改以下配置项:
+打开 `\nacos-server-2.3.0\conf\application.properties` 配置文件,修改以下配置项:
#### 配置数据源
-此处以 MySQL 数据库为例,使用 `nacos-server-2.2.3\conf\mysql-schema.sql` 初始化数据库表文件。同时修改以下配置
+此处以 MySQL 数据库为例,使用 `nacos-server-2.3.0\conf\mysql-schema.sql` 初始化数据库表文件。同时修改以下配置
```properties
#*************** Config Module Related Configurations ***************#
@@ -49,7 +49,7 @@ db.pool.config.minimumIdle=2
#### 开启鉴权
-**注意:不开启在 2.2.x 中会出现登陆失败异常!**
+**注意:不开启在 2.3.0 中会出现登陆失败异常!**
```properties
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
@@ -77,7 +77,7 @@ nacos.core.auth.plugin.nacos.token.secret.key=SecretKey0123456789012345678901234
#### Open API 鉴权
-在 nacos server 2.2.x 中使用 Open api 接口时需要鉴权:更多细节请参考:[Nacos api 鉴权](https://nacos.io/zh-cn/docs/auth.html)
+在 nacos server 2.3.0 中使用 Open api 接口时需要鉴权:更多细节请参考:[Nacos api 鉴权](https://nacos.io/zh-cn/docs/auth.html)
1. 获取 accessToken:使用用户名和密码登陆 nacos server:
@@ -107,8 +107,6 @@ nacos.core.auth.plugin.nacos.token.secret.key=SecretKey0123456789012345678901234
浏览器输入地址 http://127.0.0.1:8848/nacos ,**首次登陆需要绑定 nacos 用户,因为新版本增加了鉴权,需要应用注册和配置绑定时配置用户名和密码。**
-
-
## Nacos 应用示例
### Spring Cloud Alibaba Nacos Config
@@ -145,9 +143,9 @@ nacos.core.auth.plugin.nacos.token.secret.key=SecretKey0123456789012345678901234
3. 完成上述两步后,应用会从 Nacos Server 中获取相应的配置,并添加在 Spring Environment 的 PropertySources 中。使用 Nacos 配置中心保存 Nacos 的部分配置时,有以下四种方式:
- BeanAutoRefreshConfigExample: 通过将配置信息配置为bean,支持配置变自动刷新的例子;
- - ConfigListenerExample: 监听配置信息的例子;
- - DockingInterfaceExample: 对接 Nacos 接口,通过接口完成对配置信息增删改查的例子;
- - ValueAnnotationExample: 通过 @Value 注解进行配置信息获取的例子。
+ - ConfigListenerExample: 监听配置信息的例子;
+ - DockingInterfaceExample: 对接 Nacos 接口,通过接口完成对配置信息增删改查的例子;
+ - ValueAnnotationExample: 通过 @Value 注解进行配置信息获取的例子。
#### Nacos Server 中添加配置
@@ -345,7 +343,9 @@ SecretKey|spring.cloud.nacos.config.secret-key||
#### 查询服务验证
-在浏览器输入此地址 `http://127.0.0.1:8848/nacos/v1/ns/catalog/instances?serviceName=service-provider&clusterName=DEFAULT&pageSize=10&pageNo=1&namespaceId=`,并点击跳转,可以看到服务节点已经成功注册到 Nacos Server。
+> **注意:需要替换 accessToken!**
+
+在浏览器输入此地址 `http://127.0.0.1:8848/nacos/v1/ns/catalog/instances?accessToken=XXXXXXXXXXXXXXXXXXXXXX&serviceName=service-provider&clusterName=DEFAULT&pageSize=10&pageNo=1&namespaceId=`,并点击跳转,可以看到服务节点已经成功注册到 Nacos Server。

@@ -572,7 +572,7 @@ Metadata|spring.cloud.nacos.discovery.metadata||使用Map格式配置
}
}
- ```c
+ ```
#### Spring Cloud Gateway 应用启动
diff --git a/spring-cloud-alibaba-examples/nacos-example/readme.md b/spring-cloud-alibaba-examples/nacos-example/readme.md
index b559b68f02..c618f32f06 100644
--- a/spring-cloud-alibaba-examples/nacos-example/readme.md
+++ b/spring-cloud-alibaba-examples/nacos-example/readme.md
@@ -6,9 +6,9 @@ This project demonstrates how to use Spring Cloud Alibaba Nacos related Starters
[Nacos](https://github.com/alibaba/Nacos) It is Alibaba's open source dynamic service discovery, configuration management and service management platform that is easier to build cloud-native applications.
-## Nacos Server 2.2.x is properly configured and started
+## Nacos Server 2.3.0 is properly configured and started
-In Nacos 2.2.x, functions related to user authentication are added. When starting Nacos Server for the first time, it needs to be configured correctly to avoid the problem of startup failure.
+In Nacos 2.3.0, functions related to user authentication are added. When starting Nacos Server for the first time, it needs to be configured correctly to avoid the problem of startup failure.
### Download Nacos Server
@@ -49,7 +49,7 @@ db.pool.config.minimumIdle=2
#### Turn on authentication
-**Note: If it is not enabled, login failure exception will occur in 2.2.x!**
+**Note: If it is not enabled, login failure exception will occur in 2.3.0!**
```properties
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
@@ -77,7 +77,7 @@ nacos.core.auth.plugin.nacos.token.secret.key=SecretKey0123456789012345678901234
#### Open API authentication
-Authentication is required when using the Open api interface in nacos server 2.2.x: For more details, please refer to: [Nacos api authentication](https://nacos.io/zh-cn/docs/auth.html)
+Authentication is required when using the Open api interface in nacos server 2.3.0: For more details, please refer to: [Nacos api authentication](https://nacos.io/zh-cn/docs/auth.html)
1. Obtain accessToken: Use username and password to log in to the nacos server:
@@ -339,7 +339,7 @@ Before launching the Nacos Discovery sample for demonstration, take a look at ho
#### Query service validation
-Enter this address `http://127.0.0.1:8848/nacos/v1/ns/catalog/instances?serviceName=service-provider&clusterName=DEFAULT&pageSize=10&pageNo=1&namespaceId=` in the browser and click Jump to see that the service node has been successfully registered to the Nacos Server.
+Enter this address `http://127.0.0.1:8848/nacos/v1/ns/catalog/instances?accessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXX&serviceName=service-provider&clusterName=DEFAULT&pageSize=10&pageNo=1&namespaceId=` in the browser and click Jump to see that the service node has been successfully registered to the Nacos Server.
