无法从 '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 中配置了这个(请参阅 the 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(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 将解决此问题。

谢谢