I have the java app (on top of Spring Boot framework) installed as systemd service.
[Unit]
Description=${module_name}-service
Requires=network.target
After=syslog.target
[Service]
User=${user_name}
ExecStart=/opt/${module_name}/${module_name}-${version}.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
How to manage service restarts of some conditions, for example auto-restart after OutOfMemory errors