Spring Boot – Tomcat Port Number | Code Factory


Donate : Link

Medium Blog : Link

Applications : Link

Spring Boot lets you to run the same application more than once on a different port number.
Note : Default port number 8080.

Custom Port

In the application.properties file, we can set custom port number for the property server.port

server.port = 8081

In the application.yml file, you can find as follows

server: 
   port: 8081

Random Port

In the application.properties file, we can set random port number for the property server.port

server.port = 0

In the application.yml file, you can find as follows

server: 
   port: 0

Note − If the server.port number is 0 while starting the Spring Boot application, Tomcat uses the random port number.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s