title: How to correctly register Spring Boot app (deployed to Cloud Foundry) in Consul
body: <p>I followed this documentation: <a href="http://cloud.spring.io/spring-cloud-consul/1.0.x/index.html" rel="nofollow noreferrer">http://cloud.spring.io/spring-cloud-consul/1.0.x/index.html</a> and configured my Spring Boot application as following:</p>
  
  <pre><code>spring:
    cloud:
      consul:
        enabled: true
        host: consul.domain.tld
        port:  443
        discovery:
          instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
          fail-fast: false
  </code></pre>
  
  <p>When deployed to Cloud Foundry, the app can connect to Consul and tries to register, but Consul's "service check" instantly fails. </p>
  
  <p>Reading what is configured, I get the following instances in the Spring Boot app:</p>
  
  <pre><code>list = discoveryClient.getInstances("myApp");
  list.get(0) =&gt; "http://05c81764-18a4-4905-41a8-b5b8:8080"
  </code></pre>
  
  <p>I see that the UUID most likely is the instanceId generated by Cloud Foundry. Of course, that URL doesn't work, neither within Cloud Foundry nor for an external Consul server trying to check the service's health periodically.</p>
  
  <p>How do I have to configure my Spring Boot app correctly in order to make service registration with Consul work in Cloud Foundry? </p>