How to change Spring Boot port?


How can i change the default port of springboot from 8080

1 Answer

7 years ago by

The default port is 8080 for Spring Boot, and there are 3 ways you can change it
Let say i want to change the default port to 80 from 8080

1. Using application.properties

Add the following line in application.properties

server.port=80

2. Passing as VM argument

Add the following as your VM argument

-Dserver.port=80

3. Via System properties

System.getProperties().put("server.port", 80);
SpringApplication.run(Start.class, args);
7 years ago by Karthik Divi