xiangyq000
xiangyq000

Reputation: 131

what is the mechanism of configuring Spring Cloud Config in a bootstrap.properties file?

According to the docs, to connect to the config server, spring.application.name and spring.cloud.config.uri should be set in a bootstrap.properties file for the config client, such that the parameters fetched from the config server can be prior to those set locally. I am just wondering how this works, since:

  1. I searched the source code of Spring Cloud Config Client, but cannot find what it does with the bootstrap.properties
  2. It still works if I set spring.application.name in application.properties

Is it a feature of SpringBoot?

Upvotes: 0

Views: 100

Answers (2)

Jordi Martínez
Jordi Martínez

Reputation: 448

This feature is not located in spring-cloud-config. Instead, it is in spring-cloud-context which is a dependency of spring-cloud-config.

Basically, it creates a parent context for the actual context of the application and initializes it with the parameters of the bootstrap.

You can find more information in https://cloud.spring.io/spring-cloud-commons/multi/multi__spring_cloud_context_application_context_services.html

Upvotes: 1

spencergibb
spencergibb

Reputation: 25177

It is a feature of spring cloud. The spring.cloud.config.uri needs to be set in bootstratp.properties. This comes from the spring-cloud-commons project. My guess is you might be running the config server in the default location of localhost:8888.

Upvotes: 0

Related Questions