1. Using Basic Jar Command
java -jar webapp-1.0.0.SNAPSHOT.jar
2.Using Spring Active Profiles in Spring Boot
java -jar -Dspring.profiles.active=dev webapp-1.0.0.SNAPSHOT.jar
A Second Variation of this
java -jar -Dspring.profiles.active=dev -Dserver.port=9090 webapp-1.0.0.SNAPSHOT.jar
If you are running on any centos or linux box in production have a look at running using nohup command .
3. Run When You do not get the Reason why something bad Happened eg - like Spring Bean Creation Errors
mvn spring-boot:run
4. Running Using Jar Launcher and Extracting Jar .
My personal favorite way of deploying spring boot applications .
Step 1 :-
Jar -xvf webapp-1.0.0.SNAPSHOT.jar
Step 2 :-
java -Dspring.profiles.active=dev -Xdebug -Xnoagent -Djava.compiler=NONE org.springframework.boot.loader.JarLauncher
Note:- You can provide a hot fix in prod too using this . Give me a Like if you didn't Know this Hot Fix tricks.
Have a look in depth here .
Top comments (0)