SpringBoot : How to run Spring boot application to custom port
Points To Remember
Default port for spring boot application is 8080. You can change the port number in the following ways
- from application.properties
- command line arguments
How to run Spring boot application to custom port
In order to run a spring boot application on a custom port you can specify the port inapplication.properties.
server.port=8090
If you are using environment specific properties file then you can define server.port property in each of your properties file.
You can alternatively set the port from command line arguments like below
gradle -Dserver.port=8090 bootRun
This will override any configuration of port given inside the properties file or application.yml file.
No comments: