0
点赞
收藏
分享

微信扫一扫

IDEA+spring+spring mvc+mybatis+bootstrap+jquery+Mysql运动会管理系统

蓝哆啦呀 2023-07-13 阅读 48

问题

gateway服务集成nacos,启动后报错:
Caused by: com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information:;
版本:
jdk:1.8
spring-boot:2.7.11
spring-cloud:2021.0.6
spring-cloud-alibaba:2021.0.4.0

解决

单配置文件:application.yaml中配置
在这里插入图片描述

多配置文件:bootstrap 与applicaton:

在 Spring Boot 中有两种上下文,一种是 bootstrap, 另外一种是 application, bootstrap 是应用程序的父上下文,也就是说 bootstrap 加载优先于 applicaton.

nacos的注册与调用需要再主启动类中配置注解:@EnableDiscoveryClient

nacos的服务注册配置放到application.yaml中,gateway配置放到bootstrap.yaml
如图2:
在这里插入图片描述

举报

相关推荐

0 条评论