-
Notifications
You must be signed in to change notification settings - Fork 539
Description
Describe the bug
Spring Cloud Consul Сonfig 5.0.0
When starting a project, the initial initialization of properties with consul occurs correctly.
But each subsequent scheduled call to the ConfigWatch::watchConfigKeyValues method generates an error
2026-01-27T16:04:49.322+02:00 WARN 21920 --- [gateway] [ctor-http-nio-4] r.netty.http.client.HttpClientConnect : [0fd22999-1, L:/127.0.0.1:49984 - R:localhost/127.0.0.1:8500] The connection observed an error
io.netty.handler.timeout.ReadTimeoutException
2026-01-27T16:04:49.325+02:00 ERROR 21920 --- [gateway] [TaskScheduler-1] o.s.cloud.consul.config.ConfigWatch : Fail fast is set and there was an error reading configuration from consul.
2026-01-27T16:04:49.325+02:00 ERROR 21920 --- [gateway] [TaskScheduler-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8500/v1/kv/config/gateway,default/": null
I want to say once again that the initial initialization via spring.config.import: 'consul:' was successful. Also, if you disable watch config, there are no errors. All of the above suggests that the problem is not in Consul, but in the functionality of the ConfigWatch::watchConfigKeyValues method.
I tested the project with both WebMVC and WebFlux. I found that errors occur only when using WebFlux.
When using WebMVC, everything works correctly.
Sample
Create Spring Boot project with webflux and spring-cloud-starter-consul-config starter.
Your project will start on port 8082 since the initial initialization was successful. But later on, errors will start to be generated due to ConfigWatch::watchConfigKeyValues.
application.yaml
spring:
application:
name: gateway
config:
import: 'consul:'
cloud:
consul:
host: localhost
port: 8500Consul KV
Key: config/gateway,default/server.port
Value: 8082