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:
Control the Session with Spring Security
Simultaneous Spring WebClient Calls
Java Program to Perform Partial Key Search in a K-D Tree
Java Program to Implement Fisher-Yates Algorithm for Array Shuffling
Introduction to the Java ArrayDeque
How to Return 404 with Spring WebFlux
Java Program to Implement Brent Cycle Algorithm
String Operations with Java Streams
Java Program to Perform Optimal Paranthesization Using Dynamic Programming
Getting the Size of an Iterable in Java
Guide to java.util.Formatter
Convert Hex to ASCII in Java
Assert an Exception is Thrown in JUnit 4 and 5
Java Program to Implement Double Order Traversal of a Binary Tree
Concrete Class in Java
Spring Cloud Bus
Jackson Unmarshalling JSON with Unknown Properties
Spring REST API with Protocol Buffers
Check If a String Is Numeric in Java
Map Interface trong java
Loại bỏ các phần tử trùng trong một ArrayList như thế nào?
Spring Data JPA and Null Parameters
Java Program to Perform String Matching Using String Library
Java Program to Find Number of Articulation points in a Graph
Configure a RestTemplate with RestTemplateBuilder
Convert a Map to an Array, List or Set in Java
Spring Boot with Multiple SQL Import Files
Migrating from JUnit 4 to JUnit 5
Unsatisfied Dependency in Spring
Implementing a Runnable vs Extending a Thread
The Guide to RestTemplate
Java Program to Implement LinkedHashSet API