how to change default port in spring boot

how to change default port in spring boot

To change the default port in Spring Boot, you can use the server.port property in the application configuration.

There are several ways you can set this property:

  1. In the application.properties or application.yml file located in the src/main/resources directory of your project. For example:
server.port=8080
Source:ww‮uttual.w‬ri.com
server:
  port: 8080
  1. As a command-line argument when starting the application. For example:
java -jar myapp.jar --server.port=8080
  1. As an environment variable. For example:
export SERVER_PORT=8080
java -jar myapp.jar

In all these cases, the default port for the application will be changed to 8080.

Created Time:2017-11-01 12:05:13  Author:lautturi