首页 > 其他分享 >endpoint is blank

endpoint is blank

时间:2022-09-22 19:56:36浏览次数:59  
标签:endpoint 配置 bootstrap nacos properties application blank yml

报错图

 

问题:简单来说使用nacos作为注册中心的时候 并没有对注册中心进行配置而出现的报错

 

 

 nacos注册中心采用bootstrap.yml或者bootstrap.properties文件进行配置,所以有的人在application.yml或application.properties进行配置了 还是会报同样的错误

nacos正确的配置应该使用bootstrap.properties或bootstrap.yml进行配置,
配置信息一般是从config server 中加载的,
bootstrap.yml 是被一个父级的 Spring ApplicationContext 加载的。
这个父级的 Spring ApplicationContext是在加载application.yml 的 ApplicationContext之前先加载的

所以新建bootstrap.properties或bootstrap.yml文件进行配置 在重启即可  注意 :依赖要引入 还要在XXXApplication加上开启注解

@EnableDiscoveryClient

bootstrap.properties

spring.application.name=xxxxx
spring.cloud.nacos.config.server-addr=127.0.0.1:8848

application.yml

spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848


标签:endpoint,配置,bootstrap,nacos,properties,application,blank,yml
From: https://www.cnblogs.com/tianzhiwublogs/p/16720670.html

相关文章