This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.5.7!

Installing Spring Boot Applications

In addition to running Spring Boot applications by using java -jar directly, it is also possible to run them as services.

Installation as a systemd Service

systemd is the successor of the System V init system and is now being used by many modern Linux distributions. Spring Boot applications can be launched by using systemd ‘service’ scripts.

Assuming that you have a Spring Boot application packaged as an uber jar in /var/myapp, to install it as a systemd service, create a script named myapp.service and place it in /etc/systemd/system directory. The following script offers an example:

[Unit]
Description=myapp
After=syslog.target network.target

[Service]
User=myapp
Group=myapp

Type=exec
ExecStart=/path/to/java/home/bin/java -jar /var/myapp/myapp.jar
WorkingDirectory=/var/myapp
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
Remember to change the Description, User, Group, ExecStart and WorkingDirectory fields for your application.
The ExecStart field does not declare the script action command, which means that the run command is used by default.

The user that runs the application, the PID file, and the console log file are managed by systemd itself and therefore must be configured by using appropriate fields in the ‘service’ script. Consult the service unit configuration man page for more details.

To flag the application to start automatically on system boot, use the following command:

$ systemctl enable myapp.service

Run man systemctl for more details.

Microsoft Windows Services

A Spring Boot application can be started as a Windows service by using winsw.

A (separately maintained sample) describes step-by-step how you can create a Windows service for your Spring Boot application.