Why bootstrap.properties is ignored by spring-cloud-starter-config? Why bootstrap.properties is ignored by spring-cloud-starter-config? spring spring

Why bootstrap.properties is ignored by spring-cloud-starter-config?


With Spring Cloud 2020, they made a change in how bootstrap works and you have to include a new starter: spring-cloud-starter-bootstrap.


I spent a day on it and finally found a solution. It may help others

You need to add new dependency

<dependency>    <groupId>org.springframework.cloud</groupId>    <artifactId>spring-cloud-starter-bootstrap</artifactId></dependency>

According to the Spring Cloud 2020.0

Bootstrap, provided by spring-cloud-commons, is no longer enabled bydefault. If your project requires it, it can be re-enabled byproperties or by a new starter.

To re-enable by properties set spring.cloud.bootstrap.enabled=true orspring.config.use-legacy-processing=true. These need to be set as anenvironment variable, java system property or a command line argument.The other option is to include the new spring-cloud-starter-bootstrap(in your POM file).

I used the first option and that worked for me.


Spring Boot 2.4 introduced a new way to import configuration data via the spring.config.import property. This is now the default way to bind to Config Server.

To connect to config server set the following in application.yml:

spring:  application:    name: APPLICATION_NAME  config:    import: optional:configserver:http://USER:PASSWORD@MY_HOST:PORT/

You can see more details in: https://docs.spring.io/spring-cloud-config/docs/3.0.0/reference/html/#config-data-import