springboot项目中在application.yml或者application.properties中配置nacos项目远程地址不生效,默认启动localhost:8848

springboot2.2.8中将配置文件中的nacos地址改为远程地址后启动时仍然连接localhost

nacos.png
2020-07-18 14:03:55.538 ERROR 7212 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent      : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-07-18 14:03:57.543 ERROR 7212 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent      : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-07-18 14:03:59.545 ERROR 7212 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent      : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-07-18 14:04:01.559 ERROR 7212 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent      : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-07-18 14:04:01.559 ERROR 7212 --- [-localhost_8848] c.a.n.client.config.impl.ClientWorker    : [fixed-localhost_8848] [check-update] get changed dataId exception

java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached

解决方案

在resources目录下创建bootstrap.properties配置文件,将nacos相关配置写在该文件中即可

你可能感兴趣的:(springboot项目中在application.yml或者application.properties中配置nacos项目远程地址不生效,默认启动localhost:8848)