I am trying to connect to a consul
server from a Spring boot
application, which fails because spring cloud consul doesn't seem to read my host configuration.
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8500 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
The documentation says that we need to set the consul host from the bootstrap.properties/yml
file. I have tried setting spring.cloud.consul.host
in using by yml
and properties
format:
spring.cloud.consul.host=myhost
(with the appropriate format for .properties
vs. .yml
)
or
spring.cloud.consul.host=myhost
- fun fact, this works correctly when passing in as a program argument.
Dependencies:
- spring-boot-starter-parent - 2.0.4.RELEASE
- spring-cloud-starter-consul-all - 1.3.2.RELEASE