how to change the tomcat port in spring boot
To change the port of a Spring Boot application running on Tomcat, you can follow these steps:
Step 1: Open the application.properties
file
In your Spring Boot project, locate the application.properties
file. This file is typically located in the src/main/resources
directory.
Step 2: Add the port configuration
Inside the application.properties
file, add the following line to configure the port:
server.port=8081
Replace 8081
with the desired port number you want to use for your application.
Step 3: Save the changes
Save the application.properties
file.
Step 4: Run the application
Now, when you run your Spring Boot application, it will use the specified port. You can access your application using the new port number.
Please note that these steps assume you are using the default embedded Tomcat server provided by Spring Boot. If you are using a different server, the configuration steps may vary.