您好,登錄后才能下訂單哦!
這篇文章主要講解了“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。