In Spring Boot Actuator you can find a couple of classes to create files that are useful for process monitoring:
ApplicationPidFileWritercreates a file containing the application PID (by default in the application directory with the file name
EmbeddedServerPortFileWritercreates a file (or files) containing the ports of the embedded server (by default in the application directory with the file name
These writers are not activated by default, but you can enable them in one of the ways described below.
META-INF/spring.factories file you have to activate the listener(s):
org.springframework.context.ApplicationListener=\ org.springframework.boot.actuate.system.ApplicationPidFileWriter, org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter