Localhost:8080
Loading
Localhost:8080
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mohamed Azarudeen ZPosted May 14, 2023, 5:20 PM
To change the default port number of 8080 for a Spring Boot application, you can follow these steps:
1. Open the application.properties file located in the src/main/resources directory of your Spring Boot project.
2. Add the following line to the file: `server.port=port-number`, where "port-number" is the desired port number you want to use (e.g. 8081).
3. Save the file.
Now, when you run your Spring Boot application, it will use the new port number specified in the application.properties file instead of the default port 8080.
Alternatively, you can also specify the port number using a command-line argument when starting the application. For example, if you want to use port 8081, you can run the following command: `java -jar your-application.jar --server.port=8081` (replace "your-application.jar" with the name of your Spring Boot jar file). This will start the application on port 8081 instead of the default port.
Deepak RawatPosted May 15, 2023, 6:17 PM
Open the
application.propertiesfile located in thesrc/main/resourcesdirectory of your Spring Boot project.Add or modify the following line in the file:
propertiesCopy code
server.port=8081Replace
8081with the desired port number you want to use. Make sure the port number is not already in use by another application.Save the changes to the file.
Restart your Spring Boot application.
After restarting, your application will be accessible on the new port number you specified. For example, if you set the port number to
8081, you can access your application usinghttp://localhost:8081.If you're using
application.ymlinstead ofapplication.properties, the configuration would look like this:yamlCopy code
server: port: 8081Remember to restart your application for the changes to take effect.
Janarthanan SPosted May 15, 2023, 12:44 AM
open the resources file and type the following
server.port = type any four digit number