Table of Contents
Spring Boot lets you to run the same application 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.
1. Custom Port
In the application.properties file, we can set custom port number for the property server.port
server.port = 9090
In the application.yml file, you can find as follows −
server: port: 9090
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.
Related posts:
Quick Guide to Spring Controllers
Java – Delete a File
Deploy a Spring Boot WAR into a Tomcat Server
Custom Thread Pools In Java 8 Parallel Streams
Spring MVC Custom Validation
Apache Commons Collections BidiMap
Java Program to Check Whether Topological Sorting can be Performed in a Graph
A Guide to EnumMap
Spring Boot - Build Systems
Java Program to Find Shortest Path Between All Vertices Using Floyd-Warshall’s Algorithm
Request Method Not Supported (405) in Spring
Java Program to Implement ArrayBlockingQueue API
Spring Boot Tutorial – Bootstrap a Simple Application
Java Program to Generate All Subsets of a Given Set in the Gray Code Order
Spring Boot - Actuator
Injecting Prototype Beans into a Singleton Instance in Spring
Java Program to Perform Sorting Using B-Tree
The Registration API becomes RESTful
Java Program to Perform Naive String Matching
A Guide to TreeSet in Java
Java Program to Implement ArrayDeque API
Beans and Dependency Injection
Các kiểu dữ liệu trong java
Migrating from JUnit 4 to JUnit 5
Java Program to Implement Sieve Of Atkin
Spring Boot - Batch Service
Hướng dẫn Java Design Pattern – Proxy
Java Program to Implement Interpolation Search Algorithm
Java Program to Find a Good Feedback Edge Set in a Graph
A Guide to Spring Boot Admin
Java Program to do a Breadth First Search/Traversal on a graph non-recursively
Hướng dẫn Java Design Pattern – Chain of Responsibility