【发布时间】:2020-11-25 13:45:30
【问题描述】:
我的 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
请让我知道我做错了什么。
【问题讨论】:
标签: java spring-boot spring-cloud-config