2015-02-06 36 views
4

當我啓動Spring Cloud Config Server時,出現以下錯誤。Spring Cloud Config Server無法在啓動時找到PropertySource

Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/configserver/default/master":Connection refused; nested exception is java.net.ConnectException: Connection refused 

但是,當我在瀏覽器中打開該URL時,它存在並且配置服務器正在工作。到底是怎麼回事?

application.yml

server: 
    port: 8888 
management: 
    context-path: /admin 
logging: 
    level: 
    com.netflix.discovery: 'OFF' 
    org.springframework.cloud: 'DEBUG' 
spring: 
    cloud: 
    config: 
     server: 
     git: 
      uri: file:/home/dev/configs  

bootstrap.yml

spring: 
    application: 
    name: configserver 

回答

4

如果您配置服務器並非是一個配置的客戶端,以及需要設置spring.cloud.config.enabled=false避免日誌條目(這是無害)。

+1

謝謝配置。還有一個問題。如果該配置存在,那麼爲什麼我會在啓動時遇到錯誤?我想配置服務器也是一個客戶端。 – 2015-02-07 17:29:07

+1

你的意思是你想要它從它的資源庫中加載它自己的屬性?試試'spring.cloud.config.server.bootstrap = true'。 – 2015-02-07 17:58:36

+0

當我把'spring.cloud.config.enabled = false'錯誤消失,但這意味着它不是從版本庫讀取。如果我在存儲庫中有一個application.yml和configserver.yml,配置服務器可以從存儲庫讀取並在啓動時使用這些值(如果它是唯一的配置服務器)?對不起,我還沒有真正清楚我想弄清楚什麼。 – 2015-02-09 16:18:21

-3

的eureka.client.serviceUrl.defaultZone和spring.cloud.config。*在引導YML文件的答案

+1

你可以添加你的代碼到帖子,而不是圖片嗎? – Massimo 2017-02-07 06:17:56

相關問題