diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java index 672976db73..7aedac8983 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java @@ -53,7 +53,7 @@ public class ApplicationPidFileWriter implements private static final String[] SYSTEM_PROPERTY_VARIABLES = { "PIDFILE", "pidfile" }; - private static final String SPRING_PROPERTY = "spring.application.pidfile"; + private static final String SPRING_PROPERTY = "spring.pidfile"; private static final AtomicBoolean created = new AtomicBoolean(false); diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index e34f94ad4d..24ab69c00f 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -3,6 +3,12 @@ "name": "spring.git.properties", "dataType": "java.lang.String", "description": "Resource reference to a generated git info properties file." + }. + { + "name": "spring.pidfile", + "dataType": "java.lang.String", + "description": "The location of the PID file to write (if ApplicationPidFileWriter is used).", + sourceType: "org.springframework.boot.actuate.system.ApplicationPidFileWriter" } ]} diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java index 4672a9ad31..d46ea346eb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/ApplicationPidFileWriterTests.java @@ -87,7 +87,7 @@ public class ApplicationPidFileWriterTests { File file = this.temporaryFolder.newFile(); ConfigurableEnvironment environment = new StandardEnvironment(); MockPropertySource propertySource = new MockPropertySource(); - propertySource.setProperty("spring.application.pidfile", file.getAbsolutePath()); + propertySource.setProperty("spring.pidfile", file.getAbsolutePath()); environment.getPropertySources().addLast(propertySource); ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); given(context.getEnvironment()).willReturn(environment); @@ -103,7 +103,7 @@ public class ApplicationPidFileWriterTests { File file = this.temporaryFolder.newFile(); ConfigurableEnvironment environment = new StandardEnvironment(); MockPropertySource propertySource = new MockPropertySource(); - propertySource.setProperty("spring.application.pidfile", file.getAbsolutePath()); + propertySource.setProperty("spring.pidfile", file.getAbsolutePath()); environment.getPropertySources().addLast(propertySource); ApplicationEnvironmentPreparedEvent event = new ApplicationEnvironmentPreparedEvent( new SpringApplication(), new String[] {}, environment); diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index ade76d18ff..8c6180faa3 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -356,6 +356,9 @@ content into your application; rather pick only the properties that you need. management.contextPath= # default to '/' management.add-application-context-header= # default to true + # PID FILE ({sc-spring-boot-actuator}/system/ApplicationPidFileWriter.{sc-ext}[ApplicationPidFileWriter]) + spring.pidfile= # Location of the PID file to write + # ENDPOINTS ({sc-spring-boot-actuator}/endpoint/AbstractEndpoint.{sc-ext}[AbstractEndpoint] subclasses) endpoints.autoconfig.id=autoconfig endpoints.autoconfig.sensitive=true