您好,登录后才能下订单哦!
这篇文章主要讲解了“Spring Boot集成Apollo报Cause: [status code: 404] Could not find config for namespace怎么解决”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Spring Boot集成Apollo报Cause: [status code: 404] Could not find config for namespace怎么解决”吧!
Spring Boot 集成 Apollo 报如下异常:
10:11:21.891 [main] WARN c.c.f.a.i.RemoteConfigRepository - Load config failed, will retry in 1 SECONDS. appId: 201909261015778899, cluster: platform-tw, namespaces: application 10:11:35.087 [main] WARN c.c.f.apollo.internals.DefaultConfig - Could not load config for namespace application from Apollo, please check whether the configs are released in Apollo! Return default value now! 10:12:28.291 [Apollo-RemoteConfigRepository-1] WARN c.c.f.a.i.AbstractConfigRepository - Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId: 201909261015778899, cluster: platform-tw, namespace: application, url: http://127.0.0.1:8001/configs/pf-core/platform-tw/application?ip=127.0.0.1&messages=%7B%22details%22%3A%7B%22pf-core%2Bplatform-tw%2Bapplication%22%3A5%2C%22pf-core%2Bdefault%2Bapplication%22%3A3%7D%7D [Cause: [status code: 404] Could not find config for namespace - appId: 201909261015778899, cluster: platform-tw, namespace: application, please check whether the configs are released in Apollo!]
开始有点奇怪,我在项目中并未使用application命名空间,application.properties配置如下:
# 应用全局唯一的身份标识 app.id = 20190926778899 # Apollo Meta Server 地址 apollo.meta = http://127.0.0.1:8011 # 自定义本地配置文件缓存路径 # apollo.cacheDir = ./config apollo.cluster = platform-tw # 设置在应用启动阶段就加载 Apollo 配置 apollo.bootstrap.enabled = true # 注入 application namespace apollo.bootstrap.namespaces = redis
经查看源码,开启阿波罗配置注解@EnableApolloConfig(),默认命名空间为application,此处需注入命名空间为redis属性配置,自然会出现不能加载异常,正常做法为把注解修改为:@EnableApolloConfig(value = {"redis"})
感谢各位的阅读,以上就是“Spring Boot集成Apollo报Cause: [status code: 404] Could not find config for namespace怎么解决”的内容了,经过本文的学习后,相信大家对Spring Boot集成Apollo报Cause: [status code: 404] Could not find config for namespace怎么解决这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。