簡體   English   中英

無法從 'optional:configserver:http://localhost:8090 - SpringBoot 2.4.0 Illford 2020.0.0-M3 加載配置數據

[英]Unable to load config data from 'optional:configserver:http://localhost:8090 - SpringBoot 2.4.0 Illford 2020.0.0-M3

請提出有關新 SpringBoot 2.4.0 的問題。

首先,我們將 Config Server 和 Config Client 升級到 SpringBoot 2.4.0 + Illford 2020.0.0-M3

然后,我們遵循了設置屬性的“新方法” https://spring.io/blog/2020/08/14/config-file-processing-in-spring-boot-2-4並想堅持這個新方法。

因此,我在 application.properties 中配置了它(請參閱spring.config.import

server.port=8010
spring.application.name=mycoolservice
spring.config.import=optional:configserver:${SPRING_CLOUD_CONFIG_URI:https://localhost:8090}/config

然后,我們刪除了舊的但有效的 bootstrap.properties

server.port=8010
spring.application.name=mycoolservice
spring.cloud.config.uri=${SPRING_CLOUD_CONFIG_URI:https://localhost:8090}/config
spring.profiles.active=${SPRING_PROFILE_ACTIVE:local}

最后,我們啟動了應用程序並觀察到:

 ERROR [,,] 31987 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Unable to load config data from 'optional:configserver:https://localhost:8090/config'
    at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:124) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:111) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve$1(ConfigDataLocationResolvers.java:114) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:125) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:114) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:106) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:101) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:93) ~[spring-boot-2.4.0.jar:2.4.0]


Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'
    at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferencesForFile(StandardConfigDataLocationResolver.java:199) ~[spring-boot-2.4.0.jar:2.4.0]
    at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:121) ~[spring-boot-2.4.0.jar:2.4.0]
    ... 30 common frames omitted

請問是什么問題?

謝謝

這實際上是 SpringBoot 2.4.0 + Ilford 2020.0.0-M3 組合的已知錯誤。

為了解決這個特殊問題,SpringBoot 2.4.0 需要 Ilford 2020.0.0-M5。

從 M3 升級到 M5 將解決此問題。

謝謝

在做任何事情之前,首先簡單地檢查您的依賴項是否正確添加,因為我也遇到了這個錯誤,這只是依賴項問題。

對於gradle

implementation 'org.springframework.cloud:spring-cloud-starter-config'

暫無
暫無

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

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