报错内容:
2021-12-07 14:05:59.406 ERROR 20760 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Application failed to connect to Nacos server: ""
Action:
Please check your Nacos server config
Disconnected from the target VM, address: '127.0.0.1:61358', transport: 'socket'
Process finished with exit code 1
- 错误原因
使用nacos作为配置中心,没有配置bootstrap.yml文件。使用nacos作为配置中心时需要再项目启动前获取到配置中心的地址,用以读取配置。 - 解决方法:
配置bootstrap.yml文件后解决。
spring:
cloud:
nacos:
config:
server-addr: zk01:8848
file-extension: yaml
discovery:
server-addr: zk01:8848