pom文件如下(关键的位置):
org.springframework.boot
spring-boot-starter-parent
2.3.2.RELEASE
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-config
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
com.alibaba.cloud
spring-cloud-alibaba-dependencies
2.2.5.RELEASE
pom
import
配置文件:
spring.application.name=shell
#spring.cloud.nacos.config.server-addr=172.16.22.33:8848
#spring.cloud.nacos.config.file-extension=properties
spring.cloud.nacos.discovery.service=shell
spring.cloud.nacos.discovery.server-addr=172.16.22.33:8848
项目启动报错:
[2021-05-15 18:06:25,225] [ERROR] [com.alibaba.nacos.client.config.http.ServerHttpAgent.httpGet(ServerHttpAgent.java:109)] - [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2021-05-15 18:06:25,420] [ERROR] [com.alibaba.nacos.client.config.http.ServerHttpAgent.httpGet(ServerHttpAgent.java:109)] - [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2021-05-15 18:06:25,618] [ERROR] [com.alibaba.nacos.client.config.http.ServerHttpAgent.httpGet(ServerHttpAgent.java:109)] - [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2021-05-15 18:06:25,822] [ERROR] [com.alibaba.nacos.client.config.http.ServerHttpAgent.httpGet(ServerHttpAgent.java:109)] - [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2021-05-15 18:06:25,823] [ERROR] [com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:279)] - [fixed-localhost_8848] [sub-server] get server config exception, dataId=shell, group=DEFAULT_GROUP, tenant=
java.net.ConnectException: [NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has been reached