問題
gateway服務(wù)集成nacos,啟動(dòng)后報(bào)錯(cuò):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 是應(yīng)用程序的父上下文,也就是說 bootstrap 加載優(yōu)先于 applicaton.
nacos
的注冊(cè)與調(diào)用需要再主啟動(dòng)類中配置注解:@EnableDiscoveryClient
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-540602.html
將nacos
的服務(wù)注冊(cè)配置放到application.yaml
中,gateway
配置放到bootstrap.yaml
如圖2:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-540602.html
到了這里,關(guān)于Gateway服務(wù)集成Nacos2021.0.4錯(cuò)誤解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!