Spring Cloud Config Client not working with spring boot 2.5.1

Viewed 1354

Spring cloud config client not working with Spring Boot 2.5.1 but working with 2.5.0.

application-dev.yml

spring:
  config:
    import: configserver:http://localhost:8270/
  cloud:
    config:
      enabled: true

Error

***************************
APPLICATION FAILED TO START
***************************

Description:

Config data location 'configserver:http://localhost:8270/' does not exist

Action:

Check that the value 'configserver:http://localhost:8270/' at class path resource [application-dev.yml] - 3:13 is correct, or prefix it with 'optional:'


pom.xml

...
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
...
...
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
...

I am running Spring Cloud Config Server with Spring boot 2.4.4 and Spring Cloud version 2020.0.1

1 Answers

This is due to a regression in Spring Boot 2.4.7 and 2.5.1. The regression means that the import will not work when it’s declared in a profile-specific file. Until it has been fixed you could stay on an earlier version of Boot or temporarily move the import to application.yml.

Related