Building self-executing binaries
As of Spring Boot version 1.3, the Gradle and Maven plugins support the option of generating true executable binaries. These look like normal JAR files, but have the content of JAR fused together with the launch script that contains the command-building logic and is capable of self-starting itself without the need to execute the java -jar file.jar
command explicitly. This capability comes in very handy as it allows for the easy configuration of Linux autostart services such as init.d
or systemd
, and launchd
on macOS X.
Getting ready
For this recipe, we will use our existing application build. We will examine how the self-starting executable JAR files get created and how to modify the default launch script to add support for the custom JVM start up arguments, such as the -D
start up system properties, JVM memory, Garbage Collection, and other settings.
For this recipe, make sure that build.gradle
is using Spring Boot version 2.0.0 or above. If it is not, then...