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:
Java Program to Find Nearest Neighbor for Static Data Set
Spring REST API with Protocol Buffers
A Guide to Java SynchronousQueue
Java Program to Implement Efficient O(log n) Fibonacci generator
Biểu thức Lambda trong Java 8 – Lambda Expressions
How to Get All Spring-Managed Beans?
Assertions in JUnit 4 and JUnit 5
A Quick Guide to Spring Cloud Consul
Java Program to Find the Shortest Path from Source Vertex to All Other Vertices in Linear Time
Lớp Arrarys trong Java (Arrays Utility Class)
Java Program to Create a Balanced Binary Tree of the Incoming Data
Guide to PriorityBlockingQueue in Java
Debug a JavaMail Program
Hướng dẫn Java Design Pattern – State
Hướng dẫn Java Design Pattern – Chain of Responsibility
Java Copy Constructor
Câu lệnh điều khiển vòng lặp trong Java (break, continue)
Java Program to Implement Control Table
How to Change the Default Port in Spring Boot
Java – File to Reader
The StackOverflowError in Java
Java Program to Show the Duality Transformation of Line and Point
Java Program to Implement Gauss Seidel Method
Spring Boot - Hystrix
Java – Reader to String
Filtering a Stream of Optionals in Java
New Features in Java 14
Using the Map.Entry Java Class
Guide to java.util.concurrent.BlockingQueue
Partition a List in Java
Guide to java.util.concurrent.Future
Fixing 401s with CORS Preflights and Spring Security