change the default port in spring boot codegrepper
To change the default port in a Spring Boot application, you need to modify the application.properties
or application.yml
file. Here are the steps to do it:
- Open the
application.properties
file located in thesrc/main/resources
directory of your Spring Boot project. - Add the following line to the file:
server.port = <desired_port_number>
Replace <desired_port_number>
with the port number you want to use for your application. For example, if you want to use port number 8081, the line should be:
server.port = 8081
Note: If you are using the application.yml
file instead, the syntax will be slightly different. You can specify the port number as follows:
server:
port: <desired_port_number>
- Save the changes to the file.
That's it! The default port for your Spring Boot application has been changed. When you run your application, it will now start on the specified port.
Let me know if you need further assistance!