Medium java spring

27. How does Spring Boot decide server port priority?

Sample answer: "The port is the server.port property, default 8080, so it follows the normal property order. A command-line --server.port beats a system property, which beats the SERVER_PORT env variable, which beats application.properties. Port 0 picks a random free port."

Sources (2)
  1. How-to: Embedded web servers: Change the HTTP port
  2. External config order