Generally, we are proving spring boot application HTTP Server port using server.port in the application.properties files but if we have thousand of microservices at that time we do not like to specified service port manually instead we like to random generated free port should be automatically taken by spring boot application.

NOTE: Application will automatically take free port from OS.

Spring boot random server port can be assigned0 to server.port  in application.properties or application.yml

application.properties

server.port=0   // for spring boot server port random

application.yml

server:
  port: 0          // for spring boot server port random

References:

Spring boot server port document

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *