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:
Spring Security OAuth2 – Simple Token Revocation
Java Program to Implement Network Flow Problem
Java Program to Delete a Particular Node in a Tree Without Using Recursion
Why String is Immutable in Java?
Hướng dẫn Java Design Pattern – Template Method
Format ZonedDateTime to String
Hướng dẫn kết nối cơ sở dữ liệu với Java JDBC
Câu lệnh điều khiển vòng lặp trong Java (break, continue)
Java Program to Perform LU Decomposition of any Matrix
Control the Session with Spring Security
Limiting Query Results with JPA and Spring Data JPA
Phương thức tham chiếu trong Java 8 – Method References
Java Program to Implement Max Heap
Quick Guide to @RestClientTest in Spring Boot
Java Program to Implement Ternary Search Algorithm
Lập trình đa luồng trong Java (Java Multi-threading)
Introduction to Spring Method Security
Spring Boot Security Auto-Configuration
Java Program to Implement Johnson’s Algorithm
Java Program to Implement Horner Algorithm
Exploring the Spring 5 WebFlux URL Matching
Java Program to Implement Self Balancing Binary Search Tree
Spring RequestMapping
A Guide to Java SynchronousQueue
Spring Boot - Interceptor
Custom JUnit 4 Test Runners
Interface trong Java 8 – Default method và Static method
Java Program to Implement the Bin Packing Algorithm
LinkedList trong java
Mệnh đề Switch-case trong java
Java Program to Implement Gabow Algorithm
Java Program to Generate Random Partition out of a Given Set of Numbers or Characters