🌟 Elevate Your Coding Skills!
Enjoyed the tutorial? Subscribe to stay ahead with the latest Java and Spring Boot tips!
SUBSCRIBE TO RAM N JAVAEasily Change Port and Context Path in Eclipse
Are you tired of manually changing application.properties every time you want to test your Spring Boot app on a different port? In this guide, we'll learn how to use Eclipse Run Configurations to make these changes on the fly!
Why Use Eclipse Run Settings?
Eclipse allows you to pass Arguments directly to your application when it starts. This is incredibly useful because:
- It doesn't change your source code.
- You can create different "profiles" for different testing scenarios.
- It saves time by avoiding constant file edits.
Steps to Configure
To set your custom port and path, follow these simple steps:
- Right-click your project and select Run As > Run Configurations...
- Go to the Arguments tab.
- In the VM Arguments box, add your settings like
-Dserver.port=9090. - Click Apply and then Run!
Pro Tip for Beginners
Remember that VM Arguments must always start with -D. This tells Java that you are defining a system property that Spring Boot should pick up.
No comments:
Post a Comment