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:
Simplify the DAO with Spring and Java Generics
Java Program to Implement Merge Sort on n Numbers Without tail-recursion
Java Program to Implement Euler Circuit Problem
Guide to DelayQueue
Wiring in Spring: @Autowired, @Resource and @Inject
The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5
Java Program to Compute Determinant of a Matrix
Java Program to Delete a Particular Node in a Tree Without Using Recursion
Java Program to Implement Ford–Fulkerson Algorithm
Spring Boot - Actuator
Send an email using the SMTP protocol
Adding Parameters to HttpClient Requests
Sort a HashMap in Java
Java Program to Solve Knapsack Problem Using Dynamic Programming
Using Spring @ResponseStatus to Set HTTP Status Code
Spring Boot - Service Components
Spring Boot - Web Socket
Spring Boot Gradle Plugin
Loại bỏ các phần tử trùng trong một ArrayList như thế nào?
How to use the Spring FactoryBean?
Rest Web service: Filter và Interceptor với Jersey 2.x (P2)
Java Collections Interview Questions
Java Program to Implement CopyOnWriteArrayList API
Các kiểu dữ liệu trong java
Sử dụng Fork/Join Framework với ForkJoinPool trong Java
Query Entities by Dates and Times with Spring Data JPA
Debugging Reactive Streams in Java
Working with Kotlin and JPA
Upload and Display Excel Files with Spring MVC
Introduction to Spring Data MongoDB
Java 8 Streams peek() API
Spring REST API + OAuth2 + Angular