Spring boot (confg client) application doesn't pick bootstrap.yml
See original GitHub issueI’m creating a spring boot config client application. I’ve been referring to various online material - I’ve already referred to most of it. Im using STS. The application simply doesn’t pick up the bootstrap.yml at all. I should see the config from bootstrap file being loaded here - http://localhost:8080/env. I see entries only from application.yml, but not bootstrap. I verified my Config server is running (http://localhost:8888/trial1client/default/master) using correct GIT. Following is my POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.trial</groupId>
<artifactId>trial1client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>trial1client</name>
<description>Trial1 client</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR3</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-dependencies</artifactId>
<version>1.5.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
bootstrap.yml not loading in Spring Boot 2 - Stack Overflow
I'm experiencing a problem when starting a spring boot client application that needs to connect to the configuration server. The bootstrap.yml file is...
Read more >7. Spring Cloud Config Client
The net result of this behavior is that all client applications that want to consume the Config Server need a bootstrap.yml (or an...
Read more >Spring Cloud - Bootstrapping - Baeldung
This article shows how to bootstrap spring cloud application by employing four common microservices, the config, the discovery, ...
Read more >Spring Cloud - Application Context Services - bush
yml]" (and friends if Spring profiles are active). If you have a bootstrap.yml (or properties) then those properties are used to configure the...
Read more >Bootstrapping — Spring Cloud Config Server - Medium
Assuming you have a Spring boot 2.0 app ready to bootstrap, let's add the following dependencies. I would name this app as client-config-first....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well, here is the solution, that worked for me -
<dependencyManagement> <dependencies> <dependency><groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Camden.SR5</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Don’t ask why, just do it because it worked 😃 2. Remove following from POM -
<spring-cloud.version>Dalston.SR3</spring-cloud.version>
from<properties>
Something similar to that in in<properties>
Don’t ask why, just do it because it worked 😃 3. If you are using local file system for GIT then make sure you add ‘/.git/’ to the path e.g.spring.cloud.config.server.git.uri=C:/stswork/workspace-sts-3.9.0.RELEASE/trial1/src/main/resources/.git/
Sadly, none of the docs suggest to add ‘.git’ in the path URI.What you need to check out for -
The Solution is to add bootstrap dependency in pom.xml
With Spring Cloud 2020, they made a change in how bootstrap works and you have to include a new starter: spring-cloud-starter-bootstrap. Refer https://stackoverflow.com/questions/65063402/why-bootstrap-properties-is-ignored-by-spring-cloud-starter-config