Localhost:8080
Loading
Localhost:8080
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mohamed Azarudeen ZRank #297 · 8.5K reputationPosted May 14, 2023, 1:20 PM EDT
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.
Janarthanan SRank #224 · 11K reputationPosted May 14, 2023, 8:44 PM EDT
open the resources file and type the following
server.port = type any four digit number
Deepak RawatRank #646 · 3.7K reputationPosted May 15, 2023, 2:17 PM EDT
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.