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:
Hướng dẫn sử dụng luồng vào ra ký tự trong Java
Versioning a REST API
An Intro to Spring Cloud Vault
Java – Random Long, Float, Integer and Double
Java Program to Implement VList
Derived Query Methods in Spring Data JPA Repositories
A Guide to JPA with Spring
Spring NoSuchBeanDefinitionException
LIKE Queries in Spring JPA Repositories
Java Program to Implement String Matching Using Vectors
Hướng dẫn Java Design Pattern – Facade
Copy a List to Another List in Java
Java Program to Implement Splay Tree
Java Program to Implement Triply Linked List
The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5
JWT – Token-based Authentication trong Jersey 2.x
Java Program to Implement First Fit Decreasing for 1-D Objects and M Bins
Spring Boot - Google OAuth2 Sign-In
Spring Cloud – Securing Services
Câu lệnh điều khiển vòng lặp trong Java (break, continue)
Get and Post Lists of Objects with RestTemplate
HashSet trong Java hoạt động như thế nào?
Java Program to Find Minimum Number of Edges to Cut to make the Graph Disconnected
Java Program to Find the Number of Ways to Write a Number as the Sum of Numbers Smaller than Itself
Exploring the New Spring Cloud Gateway
HashMap trong Java hoạt động như thế nào?
Java Program to Generate Random Hexadecimal Byte
Giới thiệu luồng vào ra (I/O) trong Java
Một số từ khóa trong Java
Autoboxing và Unboxing trong Java
Spring Boot Integration Testing with Embedded MongoDB
Spring Cloud – Bootstrapping