Venkatesh.8203
Venkatesh.8203

Reputation: 1

Unable to read the application.properties from the GIT repository using Cloud Config Server

I;m trying to get the contents application.properties from my GIT repository using Spring Boot Cloud Config server, where I've saved the eureka server's URL. Am using spring boot version 2.3.4 with cloud dependency version - Hoxton.SR5.

application.properties in my config server:

spring.application.name=config-server-git

spring.config.name=sb-employee-cloud-config-server-git

server.port=8888

spring.cloud.config.server.git.uri=https://github.com/Venkatesh-8203/sb-employee-cloud-config-server-git.git

#spring.cloud.config.server.git.clone-on-start=true

#spring.cloud.config.server.git.skip-ssl-validation=true

Config server startup:

2021-04-26 20:48:44.711 INFO 14260 --- [ main] m.EmployeeCloudConfigServerSBApplication : No active profile set, falling back to default profiles: default

2021-04-26 20:48:45.486 INFO 14260 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=53849fa2-bc07-3ec6-b44c-0fe3da5e9e6a

2021-04-26 20:48:45.933 INFO 14260 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http)

2021-04-26 20:48:45.943 INFO 14260 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2021-04-26 20:48:45.943 INFO 14260 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38]

2021-04-26 20:48:46.072 INFO 14260 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2021-04-26 20:48:46.072 INFO 14260 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1345 ms

2021-04-26 20:48:46.427 INFO 14260 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'

2021-04-26 20:48:49.936 INFO 14260 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'

2021-04-26 20:48:49.986 INFO 14260 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path ''

2021-04-26 20:48:50.199 INFO 14260 --- [ main] m.EmployeeCloudConfigServerSBApplication : Started EmployeeCloudConfigServerSBApplication in 6.533 seconds (JVM running for 6.87)

2021-04-26 20:48:59.226 INFO 14260 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

2021-04-26 20:48:59.226 INFO 14260 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'

2021-04-26 20:48:59.234 INFO 14260 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms

When I hit the URL - http://localhost:8888/config-server-git/default

or

http://localhost:8888/sb-employee-cloud-config-server-git/default, I get the "Whitelabel Error Page" screen.

application.properties in my producer service:

spring.application.name=employee-producer

server.port=8080

#eureka.client.serviceUrl.defaultZone=http://localhost:8090/eureka

eureka.client.registerWithEureka=true

eureka.client.fetchRegistry=true

spring.cloud.config.uri=http://localhost:8888

spring.cloud.config.name=sb-employee-cloud-config-server-git

Could you please suggest on how to overcome this. I'm trying with test application, as I've the same issue in my official application.

Thanks, Venkatesh

Upvotes: 0

Views: 1446

Answers (1)

henry sneed
henry sneed

Reputation: 526

The employee-producer properties should be accessible at http://localhost:8888/employee-producer/default and the config server properties at http://localhost:8888/application/default

In your Git repository, make sure the names of the application properties correlate to the names given in the application.properties file. For your producer service, for example, spring.application.name=employee-producer so in your config repo, there should be a file called employee-producer.properties.

Upvotes: 1

Related Questions