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:
Jackson Unmarshalling JSON with Unknown Properties
REST Web service: Upload và Download file với Jersey 2.x
Tạo ứng dụng Java RESTful Client với thư viện Retrofit
Exploring the Spring Boot TestRestTemplate
The Guide to RestTemplate
A Guide to Java HashMap
Java Program to Perform Addition Operation Using Bitwise Operators
Converting String to Stream of chars
Hướng dẫn Java Design Pattern – Memento
Hướng dẫn Java Design Pattern – Singleton
Java Program to Implement Binary Heap
Java Program to Implement Knight’s Tour Problem
Spring Boot - Bootstrapping
Consuming RESTful Web Services
Java Program to Implement Find all Cross Edges in a Graph
Form Validation with AngularJS and Spring MVC
Finding the Differences Between Two Lists in Java
Spring Autowiring of Generic Types
Tạo ứng dụng Java RESTful Client không sử dụng 3rd party libraries
Java Program to Find Second Smallest of n Elements with Given Complexity Constraint
Compare Two JSON Objects with Jackson
Remove All Occurrences of a Specific Value from a List
Java Program to Construct an Expression Tree for an Infix Expression
Java Program to Implement AttributeList API
Beans and Dependency Injection
Java Program to Implement Merge Sort Algorithm on Linked List
Spring Boot - Rest Controller Unit Test
Java Program to Implement Quick Sort Using Randomization
A Guide to WatchService in Java NIO2
Comparing Dates in Java
Java – Generate Random String
Spring MVC and the @ModelAttribute Annotation