This tutorial will show you three different ways to change Spring Boot server port from its default 8080 to any other port you like.
The following steps are agnostic to your current Spring Boot’s embedded server, it should not make any difference whether you are using Tomcat, Jetty or Undertow.
In your application.properties
file, add the server.port
property to change Spring Boot server port. The following configuration sets the port to 9000
:
server.port=9000
However, if you’d like to change it upon startup without modifying the source code, launch the application through maven passing the server.port
as an argument. You should run the command below from the root directory of your project (the one containing the pom.xml
file:
mvn spring-boot:run -Drun.arguments="--server.port=9000"
Additionally, if you already have your application packaged into a jar file, launch it passing the server.port
parameter:
java -jar -Dserver.port=9000 springboot-helloworld-0.0.1-SNAPSHOT.jar
Hope it helps.
Cya!
This guide will show you how to create a Python function decorator with a few…
This guide will show you how to fix the error Got permission denied while trying…
This guide will show you how to create a Python virtual environment on Intellij IDEA…
This tutorial will quickly show you how to to find and kill processes on Linux,…
This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…
I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…