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 Triply Linked List
Java Program to Implement the Hill Cypher
Hướng dẫn Java Design Pattern – Interpreter
Intro to Inversion of Control and Dependency Injection with Spring
Java program to Implement Tree Set
Login For a Spring Web App – Error Handling and Localization
OAuth2 Remember Me with Refresh Token
The Order of Tests in JUnit
Spring Webflux and CORS
Abstract class và Interface trong Java
New in Spring Security OAuth2 – Verify Claims
Beans and Dependency Injection
An Intro to Spring Cloud Zookeeper
Java Program to Perform Complex Number Multiplication
Guide to @JsonFormat in Jackson
Using a Custom Spring MVC’s Handler Interceptor to Manage Sessions
Mệnh đề if-else trong java
Java Program to Construct K-D Tree for 2 Dimensional Data
Guide to BufferedReader
Introduction to Apache Commons Text
Java Program to Implement Disjoint Set Data Structure
How to Round a Number to N Decimal Places in Java
Java – Reader to InputStream
Convert a Map to an Array, List or Set in Java
Java Program to Check Whether a Directed Graph Contains a Eulerian Path
Java Program to Emulate N Dice Roller
Java Program to Implement Solovay Strassen Primality Test Algorithm
Generate Spring Boot REST Client with Swagger
Intro to Spring Boot Starters
Comparing Long Values in Java
Java Program to Implement Singly Linked List
Java String to InputStream