Is it possible to start two spring boot applications in eclipse, in the same workspace in the same time? How can i set two different ports for that two spring boot applications?
Spring boot has inbuilt tomcat, simply right click on the import project and select run as --> java application Your application will start on port 8080. Now, you can create one more similar application and can run the application on port 8081 by adding a property server. port=8081 in your 2nd application.
In Eclipse/STS, start with File -> New -> Spring Starter Project as shown below. In the next screen, you can choose the following for your project. Make sure you choose Maven as Type. In the next screen, you can choose the dependencies that you would want to add to your Spring Boot project.
Yes. It is possible to run two spring boot apps same time in the same workspace
in eclipse
. This is possible because each spring boot app comes with an embedded tomcat server
and we have to make sure that each of them uses a different port number respectively.
In each spring boot application, add application.properties
file in src/main/resources
folder. To override the default 8080
port, you have to use server.port property in the application.properties
file. Make sure you set different port in each of the application. For example, set server.port=8888
in one application and server.port=9999
in another application, so that app1 will run on 8888 port and app2 will run on 9999 port.
To scan for a free port (using OS natives to prevent clashes) use server.port=0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With