spring-bootmicroservicesspring-cloud-config-server

Spring cloud config server is not reading the properties file in local git repository


I am trying to read the properties file for a micro service in local git repository. Its not adding the file details in the propertySource. it is coming as blank.

Request - http://localhost:8888/limit-service/default

Response - {"name":"limit-service","profiles":["default"],"label":null,"version":"91d0b396ff46642fc4efc1ec31e616487f51b10b","state":null,"propertySources":[]}

Name of properties file present in local git repo - limit-service.properties

Below is the config detail of config server -

spring.application.name=spring-cloud-config-server
server.port = 8888
logging.level.org.springframework = trace
spring.cloud.config.server.git.uri=file:///E:/microservice/git-local-repo

Please refer the below log while trying to request for the details -

2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Processing imports [file:/E:/microservice/git-local-repo/]
2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application.properties
2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application.yml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application.yaml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.yml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.yaml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.properties
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.yml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.yaml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.properties
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.xml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.yml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver     : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.yaml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Nothing imported
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Processed imports for of 1 contributors`enter code here`
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment     : Applying config data environment contributions
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment     : Adding imported property source 'Config resource 'file [E:\microservice\git-local-repo\limit-service.properties]' via location 'file:/E:/microservice/git-local-repo/''
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment     : Setting default profiles: [default]
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment     : Setting active profiles: [default]
2020-12-18 15:50:48.510 DEBUG 14392 --- [nio-8888-exec-2] o.s.core.env.StandardEnvironment         : Activating profiles [default]
2020-12-18 15:50:48.511 TRACE 14392 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository  : Testing pattern: E:/microservice/git-local-repo/ with property source: E:\microservice\git-local-repo\limit-service.properties
2020-12-18 15:50:48.511 DEBUG 14392 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository  : Not adding property source: E:\microservice\git-local-repo\limit-service.properties
2020-12-18 15:50:48.511 DEBUG 14392 --- [nio-8888-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/avif, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8] and supported [application/json]
2020-12-18 15:50:48.512 TRACE 14392 --- [nio-8888-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Writing [Environment [name=limit-service, profiles=[default], label=null, propertySources=[], version=91d0b396ff46642fc4efc1ec31e616487f51b10b, state=null]]
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] s.w.s.m.m.a.RequestMappingHandlerAdapter : Applying default cacheSeconds=-1
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet        : No view rendering, null ModelAndView returned.
2020-12-18 15:50:48.513 DEBUG 14392 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet        : Completed 200 OK, headers={masked}
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] o.s.b.w.s.f.OrderedRequestContextFilter  : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@252c2bfc

Solution

  • this issue you must be facing with Spring boot 2.4.1, I suggest to create new project with Spring boot with stable version and It will work.