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 the GCD and LCM of two Numbers
Hướng dẫn sử dụng luồng vào ra nhị phân trong Java
How to Store Duplicate Keys in a Map in Java?
JUnit5 @RunWith
Java Program to Implement Park-Miller Random Number Generation Algorithm
Java Multi-line String
Intro to Inversion of Control and Dependency Injection with Spring
Send an email using the SMTP protocol
Java Program to Check for balanced parenthesis by using Stacks
Spring’s RequestBody and ResponseBody Annotations
Query Entities by Dates and Times with Spring Data JPA
Lớp Collections trong Java (Collections Utility Class)
Introduction to Spring Cloud OpenFeign
A Guide to JUnit 5
Java Program to Implement Heap’s Algorithm for Permutation of N Numbers
Mệnh đề if-else trong java
Overflow and Underflow in Java
Spring Boot - Thymeleaf
Lớp LinkedHashMap trong Java
Spring Boot - Google Cloud Platform
Wrapper Classes in Java
Check if a String is a Palindrome in Java
Java Program to Implement Binary Search Tree
Java Program to Implement Hash Tables Chaining with List Heads
Map to String Conversion in Java
Using a Custom Spring MVC’s Handler Interceptor to Manage Sessions
Java Program to Implement Counting Sort
Hướng dẫn Java Design Pattern – DAO
Lớp Properties trong java
Spring REST API + OAuth2 + Angular
Multipart Upload with HttpClient 4
StringBuilder vs StringBuffer in Java