Spring Boot – How to Configure HTTP Port

In a standalone application the main HTTP port defaults to 8080. To change the port, we need to update server.port in following ways.

1.Change default port in application.properties or application.yml

  • Update via a properties file

  • Update via a yml file

2. Implement EmbeddedServletContainerCustomizer

3. Change default port from Command Line

Update the port by passing the system property (-Dserver.port=8888) as below.

4. Change default port to Random port

To scan for a free port (using OS natives to prevent clashes) use server.port=0


1. Embedded servlet containers


Click Here to Leave a Comment Below 0 comments