Spring Boot command line arguments example

How to run a Spring Boot app with JVM params and command line arguments


When you run a Spring Boot application from the command line, and you want to do any of the following:

Then start your application like this:

java [java options...] \
    -jar path/to/spring-boot-application.jar \
    --spring.property.name=value, ... \
    --application.property.name=value, ... \


This example first compiles a Spring Boot application with Maven.

Then, it starts the application. It sets HTTPS proxy configuration, unlocks features for Mission Control, makes Spring use a local Profile, and sets some custom application properties:

$ mvn clean package
$ java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder \
    -Dhttps.proxyHost=yourproxy.yourcompany.com \
    -Dhttps.proxyPort=8080 \
    -Dhttps.proxyUser=$PROXY_USER \
    -Dhttps.proxyPassword=$PROXY_PASS \
    -jar target/application-1.0.0-SNAPSHOT.jar \
    --spring.profiles.active=local \
    --breakfast.eggs=poached \


What do you think? You can use Markdown in your comment. To write code, indent each line with 4 spaces.