Spring cloud config server not able to read property file

Viewed 2637

My Spring cloud config server is throwing below error when trying to access the property file content using 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)

My application.properties in config server looks like this

spring.cloud.config.server.git.uri=/Users/joe/MyProgs/Java/spring-ws/config and I even tried with this spring.cloud.config.server.git.uri=${HOME}/MyProgs/Java/spring-ws/config

Content of the property file in the local git repository is

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

Please let me know what I am doing wrong.

1 Answers

It looks like this deprecation message was added just a couple of weeks ago in this issue. These changes are not even released yet (marked for release in a future milestone version of Spring Boot 2.4.0-M2).

What version of Spring Boot are you using? I suppose you have a SNAPSHOT dependency somewhere in your build configuration.

Related