Menu

How to change default port for Spring boot

Default port for Spring boot application is 8080, what if someone want to run their application other than port 8080 or other than default port. Where we need to put the port setting in project, so instead of default port 8080 Spring boot application start on port which we configure.

By Default Spring boot run on port 8080 and no where in your project you will find the port setting, if you just started a new Spring boot project. If you want to change the default port then you have to add the port setting in your project.

Where to put the port setting?

We need to add port setting in projects application.properties file. You will find this properties file under project directory > src > main > resources > application.properties

open application.properties file and add a new property server.port followed by port number. below is the example.
server.port = 8020

No comments:

Post a Comment