场景复现:
一:原配置文件application.yml
bash
spring:
cloud:
nacos:
config:
server-addr: ${cas-wict-nacos-url}
namespace: ${cas-wict-nacos-namespace}
shared-configs:
- data-id: mysql.properties
refresh: true
- data-id: mysql.properties
refresh: true
- data-id: job.properties
refresh: true
discovery:
server-addr: ${cas-wict-nacos-url}
namespace: ${cas-wict-nacos-namespace}
cluster-name: failover
metadata:
protocol: rest
一直报错:currentServerAddr:http://localhost:8848, err : connect timed out
原因:老版本nacos一直优先读本地的bootstrap.properties, 导致application.yml的nacos没能读取到
解决办法:
新增一个bootstrap.properties配置,里面方nacos的配置