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:
Adding Shutdown Hooks for JVM Applications
Java Program to Find Nearest Neighbor Using Linear Search
Intro to the Jackson ObjectMapper
Auditing with JPA, Hibernate, and Spring Data JPA
Spring Security 5 for Reactive Applications
Guide to @ConfigurationProperties in Spring Boot
Dockerizing a Spring Boot Application
Java Program to Implement Find all Forward Edges in a Graph
Returning Custom Status Codes from Spring Controllers
Vector trong Java
Netflix Archaius with Various Database Configurations
Spring Boot - Rest Controller Unit Test
Java – Reader to InputStream
Java – Byte Array to Reader
Java Program to Implement TreeSet API
Prevent Brute Force Authentication Attempts with Spring Security
Java Program for Douglas-Peucker Algorithm Implementation
Logging in Spring Boot
Java Program to Implement Lloyd’s Algorithm
Java Program to Implement Randomized Binary Search Tree
Java Program to Implement Queue using Two Stacks
Compact Strings in Java 9
Wrapper Classes in Java
An Intro to Spring Cloud Task
Java Program to Find the Peak Element of an Array O(n) time (Naive Method)
The Difference Between Collection.stream().forEach() and Collection.forEach()
Generate Spring Boot REST Client with Swagger
Spring MVC Custom Validation
Lập trình đa luồng với CompletableFuture trong Java 8
Java Program to Implement the Hungarian Algorithm for Bipartite Matching
Lớp LinkedHashMap trong Java
Java Program to find the maximum subarray sum using Binary Search approach