Example usage for org.springframework.boot.system ApplicationPid ApplicationPid

List of usage examples for org.springframework.boot.system ApplicationPid ApplicationPid

Introduction

In this page you can find the example usage for org.springframework.boot.system ApplicationPid ApplicationPid.

Prototype

public ApplicationPid() 

Source Link

Usage

From source file:org.springframework.boot.context.ApplicationPidFileWriter.java

private void writePidFile(SpringApplicationEvent event) throws IOException {
    File pidFile = this.file;
    String override = getProperty(event, FILE_PROPERTIES);
    if (override != null) {
        pidFile = new File(override);
    }//from w  ww .j ava 2s .c o m
    new ApplicationPid().write(pidFile);
    pidFile.deleteOnExit();
}

From source file:org.springframework.boot.context.logging.LoggingApplicationListenerTests.java

@Test
public void logFilePropertiesCanReferenceSystemProperties() {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.file=target/${PID}.log");
    this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
    assertThat(System.getProperty(LoggingSystemProperties.LOG_FILE))
            .isEqualTo("target/" + new ApplicationPid().toString() + ".log");
}