English 中文(简体)
Spring Boot Tutorial

Spring Boot Resources

Selected Reading

Spring Boot - Tomcat Port Number
  • 时间:2024-09-17

Spring Boot - Tomcat Port Number


Previous Page Next Page  

Spring Boot lets you to run the same apppcation more than once on a different port number. In this chapter, you will learn about this in detail. Note that the default port number 8080.

Custom Port

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

server.port = 9090

In the apppcation.yml file, you can find as follows −

server: 
   port: 9090

Random Port

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

server.port = 0

In the apppcation.yml file, you can find as follows −

server: 
   port: 0

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

Advertisements