'spring-boot v2.4.3: Config data resource via location 'consul:' does not exist
I am trying to run a springboot app locally by reading application.properties from a remote consul server. I'm getting Config data resource via location 'consul:' does not exist error message.
Springboot version: 2.4.3
Java version: 1.8
spring-cloud version: 2020.0.3
Related dependencies used:
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<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>
application.properties:
spring.config.import=consul:
#Consul Configuration
spring.cloud.consul.host=${CONSUL_HOST:localhost}
spring.cloud.consul.port=${CONSUL_PORT:8500}
spring.cloud.consul.config.enabled=true
spring.cloud.consul.config.failFast=true
spring.cloud.consul.config.format=properties
spring.cloud.consul.config.prefixes=${CONSUL_PREFIXES:config}
spring.cloud.consul.config.name=${CONSUL_CONFIG:b2bv2-order}
spring.cloud.consul.config.data-key=application.properties
spring.application.name=b2bv2-order
Error when trying to run docker image: error
I have also used org.springframework.cloud.client.discovery.EnableDiscoveryClient annotation on Application main class.
How do I fix this issue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
