title: spring boot app actually running on port 0, instead of random
body: <p>my application.properties file contains </p>
  
  <pre><code>server.port=0
  </code></pre>
  
  <p>Which is supposed to be captured by spring boot and set it to a random port.</p>
  
  <p>Instead it actually launches it on port 0, its even in the spring log as such:</p>
  
  <pre><code>01/Mar/2019 12:50:43,600- TomcatEmbeddedServletContainer: Tomcat initialized with port(s): 0 (http)
  </code></pre>
  
  <p>Eureka sees it as an 'up' service, and provides the link to the service (<code>localhost:0/info</code>), clicking on it gives my browser '<code>ERR_ADDRESS_INVALID</code>', guessing because its not a valid port..</p>
  
  <p>App is running to send heartbeats to Eureka, but why is spring not setting it a random port number?</p>
  
  <p>Are there any settings that can prevent the random? if so how to unset them?</p>
  
  <p><strong>edit:</strong> any new boot apps the server.port=0 is random, its just not working for an existing spring boot application that lots of dependencies </p>