簡體   English   中英

Spring Cloud Server 未從 BitBucket/Gitlab 導入集中配置

[英]Spring Cloud Server not importing centralized configuration from BitBucket/Gitlab

我正在嘗試為 Spring Cloud 集中配置實現一個示例。 我有我的 Spring Cloud 服務器,它從 git 存儲庫獲取配置並將它們發送到另一個應用程序。 如果我使用公共 Github 存儲庫沒有問題,但是當我使用GitlabBitbucket私有存儲庫時,我無法加載我的新配置。

這是我的服務器 application.properties:

server.port=8888
#gitlab
spring.cloud.config.server.git.uri=https://gitlab.com/myusername/reponame
spring.cloud.config.server.git.username=myusername
spring.cloud.config.server.git.password=mypassword

我還嘗試以這種方式指定 uri:

spring.cloud.config.server.git.uri=https://gitlab.com/myusername/reponame.git

沒有結果。 存儲庫中的項目與從我的公共 Github 存儲庫導入的項目(有效的)完全相同。

另一個奇怪的問題,關於接收到配置的客戶端是,如果換上@SpringBootApplication或者把我的@RestController,所以我必須重新啟動客戶端應用程序,讓它獲得新的配置,@RefreshScope不起作用。

這是正確的配置(仔細檢查了我自己的配置),因此通過傳遞憑據的 git clone 確保用戶名/密碼正確:

git clone https://myusername:mypassword@gitlab.com/myusername/reponame

此外,@RefreshScope 不會輪詢更新的配置。 您需要 POST 到 /refresh 端點(需要啟用)

curl -X POST http://localhost:8080/refresh

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM