我有一個彈簧雲問題:執行應用程序時,我沒有使用application.yml中的設置,因爲spring.cloud.config 。讓我在這裏提供更多細節。 我想我的服務可以從遠程ConfigServer獲取設置。我已將ConfigServer創建爲帶有註釋@EnableConfigServer的Spring Boot應用程序。 後,我已經創建了下一個配置文件,客戶端應用程序:執行應用程序時,不會使用application.yml中的設置執行應用程序
application:
name: mw
cloud:
config:
enabled: true
uri: http://172.17.42.1:8888
fail-fast: true
主類:
@EnableEurekaClient
@SpringBootApplication
public class MwApplication
和額外的配置到應用程序:
@Configuration
@EnableJpaRepositories(basePackages = {"com.sample.repository"})
@EnableTransactionManagement
@EnableScheduling
public class AppConfiguration
還我旁邊的依賴關係:
spring-cloud-starter-eureka
spring-cloud-config-client
spring-boot-configuration-processor
spring-boot-starter-data-jpa
當我執行我的客戶端應用程序,因爲我得到了這樣的信息:ConfigServicePropertySourceLocator:找不到PropertySource:對GET請求「http://localhost:8888/mw/default」
的應用程序試圖從默認的URI(本地主機)的數據I/O錯誤,而不是從我的設置中使用uri。我已經在調試模式下看過app,看到org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration創建了ConfigClientProperties和默認屬性,我的application.yml設置沒有被使用。
我在做什麼錯了? 謝謝。
我已經嘗試過了,再次添加,但沒有改變的,我還是有這個問題 – slippery
嘗試移動application.yml配置bootstrap.yml – Andonaeus
現在的作品,謝謝!你能說出爲什麼它不適用於應用程序。陽明海運? 我沒有自己創建application.yml。它是由spring構造函數 – slippery