无法从“”加载配置数据optional:configserver:http://localhost:8090-springboot 2.4.0 illford 2020.0.0-m3

xzabzqsa  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(671)

关于新的springboot2.4.0的问题。
首先,我们将配置服务器和配置客户端升级到springboot2.4.0+illford2020.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

请问有什么问题?
谢谢您

pw136qt2

pw136qt21#

这实际上是springboot 2.4.0+ilford 2020.0.0-m3组合的已知错误。
为了解决这个特殊的问题,springboot2.4.0需要ilford2020.0.0-m5。
从m3升级到m5可以解决这个问题。
谢谢您

相关问题