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.
META-INF/spring.factories file you have to activate the listener: