Spring Boot command line arguments example
When you run a Spring Boot application from the command line, and you want to do any of the following:
- configure HTTP/HTTPS proxy settings for the Java Virtual Machine
- set JVM memory limits
- change the profile of your Spring Boot app
- set Spring Boot application properties
- override any other properties on a Spring Boot app
Then start your application like this:
java [java options...] \
-jar path/to/spring-boot-application.jar \
--spring.property.name=value, ... \
--application.property.name=value, ... \
Example
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 \
--dinner.eggs=boiled