spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
813 stars 541 forks source link

Backward compatibility broken for "spring.cloud.consul.host" that contains both host:port value #806

Closed hagargi closed 1 year ago

hagargi commented 1 year ago

I observe when spring-boot application that uses consul was upgraded, backward compatibility broken w.r.t how host, port specified. Earlier in spring-boot:jar:2.1.4.RELEASE , spring-cloud-consul-core:jar:2.1.1 usage, users were allowed to specify host & port together in single property "spring.cloud.consul.host", eg https://:8610, now with current version we get invalid error as Spring-cloud is forcefully appending default consul port 8500.

Error Details:

[ERROR] 2023-01-08 16:12:33,644 [main] org.springframework.boot.SpringApplication org.springframework.boot.SpringApplication Application run failed org.springframework.cloud.consul.config.ConsulPropertySources$PropertySourceNotFoundException: com.ecwid.consul.transport.TransportException: org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: https://:8610:8500/v1/kv/abc/services/xyz-service/?recurse&token=yyy-xxx at org.springframework.cloud.consul.config.ConsulPropertySources.createPropertySource(ConsulPropertySources.java:143)

spencergibb commented 1 year ago

Please use the spring.cloud.consul.port property.