-
Notifications
You must be signed in to change notification settings - Fork 539
Description
Describe the bug
When using Spring Cloud Consul Config, the application logs a warning during configuration watch execution indicating that the response from Consul cannot be parsed. The error suggests that Consul returns a response with content type text/html;charset=utf-8, but Spring expects a JSON response that can be converted into List.
consul responds with : "301 MOVED_PERMANENTLY"
line: https://github.com/spring-cloud/spring-cloud-consul/blob/00397e92b2d71f66107ad00c1f5a76c53398c952/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConfigWatch.java#L159
spring.config.import=consul:/test
As a result, the Consul Key/Value configuration for the specified context is not read successfully.
Observed behavior
The following warning is logged repeatedly by the ConfigWatch task:
WARN --- [TaskScheduler-1] o.s.cloud.consul.config.ConfigWatch :
Error querying consul Key/Values for context '/test/'.
Message: Could not extract response: no suitable HttpMessageConverter found for response type
[java.util.List<org.springframework.cloud.consul.model.http.kv.GetValue>]
and content type [text/html;charset=utf-8]
Expected behavior
Spring Cloud Consul Config should successfully query the KV endpoint for the configured context and deserialize the response into GetValue objects without errors.
Environment
Spring Boot: 4.0.1
Spring Cloud version: 2025.1.0
Spring Cloud Consul version: 5.0.0
Consul version: 1.22.2
Java version: 25