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 Implement ArrayList API
Java Program to Check whether Directed Graph is Connected using BFS
Java 8 StringJoiner
Java Program to Implement EnumMap API
Giới thiệu Aspect Oriented Programming (AOP)
How to Get a Name of a Method Being Executed?
Java Program to Find the Connected Components of an UnDirected Graph
Java Program to Check whether Undirected Graph is Connected using BFS
Spring Autowiring of Generic Types
So sánh ArrayList và LinkedList trong Java
Fixing 401s with CORS Preflights and Spring Security
Java 14 Record Keyword
Java Program to Implement Adjacency List
Java Program to Check whether Graph is Biconnected
Class Loaders in Java
Understanding Memory Leaks in Java
Introduction to the Functional Web Framework in Spring 5
Spring Cloud AWS – EC2
Why String is Immutable in Java?
Mapping Nested Values with Jackson
Loại bỏ các phần tử trùng trong một ArrayList như thế nào?
REST Web service: Basic Authentication trong Jersey 2.x
Java Program to Solve Tower of Hanoi Problem using Stacks
Java Program to Implement Sieve Of Atkin
Java Program to Generate a Sequence of N Characters for a Given Specific Case
Spring Boot - Actuator
Spring Data MongoDB Transactions
Most commonly used String methods in Java
Java Program to Implement Borwein Algorithm
Send email with SMTPS (eg. Google GMail)
Spring Boot - Code Structure
@Order in Spring