JavaCodingNerd

Java Coding Nerd. This Blog will feature content-rich articles, tutorials and own opinions on variuos programming related topcis.

Spring Boot

How to change the Spring Boot default port

Spring Boot

How to change the Spring Boot default port

The port 8080 is a rather popular one so no wonder most services use it as a default port. So if you want to start your Spring Boot Application u may jump right into a “port already in use” exception insteand of seeing your application running.

There are two easy options to change the default adress

You can either type in this command when you start your spring boot application with maven

mvn spring-boot:run -Drun.jvmArguments=’-Dserver.port=8081′

But you would have to do that each time. The other option is permanent. In your Project under java/main/resources create a file application.properties and add your desired port  server.port = 8081

You can now start your application with the standart command mvn spring-boot:run

Spread the love

Leave a Reply

Theme by Anders Norén