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 Check Cycle in a Graph using Graph traversal
Java Program to Implement Trie
Java Program to Check Whether Topological Sorting can be Performed in a Graph
Java Program to Implement Pagoda
A Guide to Concurrent Queues in Java
Composition, Aggregation, and Association in Java
Collect a Java Stream to an Immutable Collection
Service Registration with Eureka
Spring Data Java 8 Support
Validations for Enum Types
Introduction to PCollections
Phương thức forEach() trong java 8
Java Program to Implement Self organizing List
RegEx for matching Date Pattern in Java
The Dining Philosophers Problem in Java
Java Program to Perform Search in a BST
Spring Boot - Rest Template
Vector trong Java
Filtering a Stream of Optionals in Java
ETL with Spring Cloud Data Flow
Debug a JavaMail Program
Java Program to Implement Heap Sort Using Library Functions
Multipart Upload with HttpClient 4
Introduction to Spring Data JDBC
Java Program to Implement Affine Cipher
Spring Boot - Batch Service
Xử lý ngoại lệ trong Java (Exception Handling)
Spring MVC Async vs Spring WebFlux
Java Program to Implement RoleUnresolvedList API
Java Program to Implement Find all Back Edges in a Graph
Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java
How to Read a File in Java