When I start Consul, then the app, and then create some configuration, the app would read it and apply at runtime.
However if the app is started before Consul it wouldn't be able to read the configuration and its changes.
According to the official documentation https://cloud.spring.io/spring-cloud-consul/reference/html/ (Section 5. Consul Retry) it could be fixed.
I applied the recommendations there by adding the following dependencies to the project:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.3.3</version>
</dependency>
and using the following settings in bootstrap.yml
spring:
application:
name: my-service
cloud:
consul:
config:
enabled: true
fail-fast: false
host: localhost
port: 8500
retry:
max-attempts: 100
enabled: true
initial-interval: 1000
max-interval: 2000
However it didn't help. What can go wrong?
Using:
spring-cloud-starter-consul-config:jar:3.0.1
spring-boot.version=2.4.3
spring-cloud-starter-consul:jar:3.0.1
boot:spring-boot-starter-aop:jar:2.4.2