Rahul Kumar (@rahul)
We often don’t need to run multiple instances of our spring boot application on the same machine but learning them would be quite interesting.
I am assuming that you know about spring boot!.
First, you need to open a terminal at the root of your application. Once you have opened the terminal type the following.
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8080
You can change 8080
to your desired port number.
Open application.properties
and add the following
# application.properties
server.port=0
Setting server.port=0
will start the spring boot application on a random port. You can easily get the port number from logs.
LiveReload server is running on port 35729
Tomcat started on port(s): 65449 (http) with context path ''
As you can see the port number 65449
has been printed on the terminal. Which can be used further to make HTTP requests.
Add a thoughtful comment...
✨ Explore more tech insights and coding wonders with @dsabyte! Your journey in innovation has just begun. Keep learning, keep sharing, and let's continue to code a brighter future together. Happy exploring! 🚀❤️
Join the "News Later" community by entering your email. It's quick, it's easy, and it's your key to unlocking future tech revelations.
Weekly Updates
Every week, we curate and deliver a collection of articles, blogs and chapters directly to your inbox. Stay informed, stay inspired, and stay ahead in the fast-paced world of technology.
No spam
Rest assured, we won't clutter your inbox with unnecessary emails. No spam, only meaningful insights, and valuable content designed to elevate your tech experience.