Skip to content

Instantly share code, notes, and snippets.

@JaS4083
JaS4083 / spring_app_as_linux_service.gist
Created September 2, 2020 15:33 — forked from brandonjyee/spring_app_as_linux_service.gist
Deploying Spring Boot app as a Linux service
This method uses the modern systemd way to run a Java JAR (i.e. a Spring Boot app) as a daemon as opposed to using the older method of using init.d (SystemV). Using the "&" symbol to run the process in the background isn't sufficient b/c the process will be shut down when the terminal closes (or when you exit your SSH session if remoting in to the machine). Using the "nohup" command is another option, but that is like the "poor man's way" of running a service: doesn't restart on machine reboot; program ignores interrupts, quit signals, and hangups. For more info see: https://stackoverflow.com/questions/958249/whats-the-difference-between-nohup-and-a-daemon .
Anyways, to create a Linux daemon the systemd way:
Create a service file in /etc/systemd/system. Let's call it javaservice.service. Let the contents be:
[Unit]
Description=My Java Service
[Service]
@JaS4083
JaS4083 / Customer.java
Created July 22, 2019 14:13 — forked from TheB1ackSheep/Customer.java
Java Bean Example
package model;
import java.util.List;
public class Customer {
private String name;
private String email;
private String password;
private String[] qoute;
private boolean isAdmin;