Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring cloud config client is not getting/loading configuration files from config server after upgrading to 2.4.0

spring-cloud-config-client is not able to read configuration files from the spring-cloud-config-server after upgrading to 2.4.0 with spring-cloud version 2020.0.0-M6

like image 835
Thirumal Avatar asked Dec 06 '20 08:12

Thirumal


2 Answers

From spring-boot 2.4.0 version, bootstrapping is not enabled by default, need to add the following dependency in your build.gradle

implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'

or pom.xml

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
like image 186
Thirumal Avatar answered Jan 04 '23 13:01

Thirumal


Adding to the application file (.properties or .yml) the property spring.config.import , with this it is not necessary to change/add the project's dependencies

Example:

  • To connect with the default location of "http://localhost:8888" or de value defined in the property spring.cloud.config.uri

spring.config.import=optional:configserver:

For more info: https://docs.spring.io/spring-cloud-config/docs/3.0.0/reference/html/#config-data-import

like image 45
Hillmer Chona Avatar answered Jan 04 '23 13:01

Hillmer Chona