Make PID and application version available in the environment

Adds the following new properties:

- spring.application.pid
- spring.application.version

Refactors the ResourceBanner and the structured logging support to use
the new properties.

Closes gh-41604
This commit is contained in:
Moritz Halbritter
2024-07-31 13:33:18 +02:00
parent 518bc69bb7
commit f4b4f4f0bf
22 changed files with 267 additions and 96 deletions

View File

@@ -160,11 +160,11 @@ class SpringBootContextLoaderTests {
.stream()
.map(PropertySource::getName)
.collect(Collectors.toCollection(ArrayList::new));
String last = names.remove(names.size() - 1);
String configResource = names.remove(names.size() - 2);
assertThat(names).containsExactly("configurationProperties", "Inlined Test Properties", "commandLineArgs",
"servletConfigInitParams", "servletContextInitParams", "systemProperties", "systemEnvironment",
"random");
assertThat(last).startsWith("Config resource");
"random", "applicationInfo");
assertThat(configResource).startsWith("Config resource");
}
@Test