diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidListener.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidListener.java index 8973ae4fad..ae7ee748db 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidListener.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidListener.java @@ -80,6 +80,7 @@ public class ApplicationPidListener implements if (created.compareAndSet(false, true)) { try { new ApplicationPid().write(this.file); + this.file.deleteOnExit(); } catch (Exception ex) { logger.warn(String.format("Cannot create pid file %s", this.file));