In Spring Boot Actuator you can find ApplicationPidListener
which creates file
containing application PID (by default in application directory and file name is
application.pid
). It’s not activated by default, but you can do it in two simple
ways described below.
In META-INF/spring.factories
file you have to activate the listener:
org.springframework.context.ApplicationListener=\ org.springframework.boot.actuate.system.ApplicationPidListener