Spring 云配置服务器无法读取 属性 文件

Spring cloud config server not able to read property file

我的 Spring 云配置服务器在尝试使用 http://localhost:8080/application/default

访问 属性 文件内容时抛出以下错误
There was an unexpected error (type=Internal Server Error, status=500).
Could not construct context for config=application profile=default label= includeOrigin=false; nested exception is java.lang.IllegalStateException: ConfigFileApplicationListener [org.springframework.boot.context.config.ConfigFileApplicationListener] is deprecated and can only be used as an EnvironmentPostProcessor
org.springframework.cloud.config.server.environment.FailedToConstructEnvironmentException: Could not construct context for config=application profile=default label= includeOrigin=false; nested exception is java.lang.IllegalStateException: ConfigFileApplicationListener [org.springframework.boot.context.config.ConfigFileApplicationListener] is deprecated and can only be used as an EnvironmentPostProcessor
    at org.springframework.cloud.config.server.environment.NativeEnvironmentRepository.findOne(NativeEnvironmentRepository.java:161)
    at org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository.findOne(AbstractScmEnvironmentRepository.java:59)
    at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:187)
    at org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne(CompositeEnvironmentRepository.java:58)
    at org.springframework.cloud.config.server.environment.EnvironmentEncryptorEnvironmentRepository.findOne(EnvironmentEncryptorEnvironmentRepository.java:61)
    at org.springframework.cloud.config.server.environment.EnvironmentController.getEnvironment(EnvironmentController.java:136)
    at org.springframework.cloud.config.server.environment.EnvironmentController.defaultLabel(EnvironmentController.java:108)
    at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

我的 application.properties 在配置服务器中看起来像这样

spring.cloud.config.server.git.uri=/Users/joe/MyProgs/Java/spring-ws/config 我什至尝试过这个 spring.cloud.config.server.git.uri=${HOME}/MyProgs/Java/spring-ws/config

本地 git 存储库中 属性 文件的内容是

martin:
    name: Martin D'vloper
    job: Developer
    skill: Elite

请让我知道我做错了什么。

这条弃用消息似乎是几周前在 this issue 中添加的。这些更改甚至还没有发布(标记为在 Spring Boot 2.4.0-M2 的未来里程碑版本中发布)。

您使用的 Spring 引导程序是什么版本?我想你的构建配置中某处有一个 SNAPSHOT 依赖项。