From 302ba7781263254999aff0923888d6f1131811b4 Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Fri, 18 Dec 2020 17:13:30 -0800 Subject: [PATCH] Improve documentation regarding git commit info Closes gh-24205 --- .../spring-boot-docs/src/docs/asciidoc/howto.adoc | 2 ++ .../src/docs/asciidoc/production-ready-features.adoc | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc index fed71a7949..61a9f54568 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc @@ -2535,6 +2535,8 @@ Gradle users can achieve the same result by using the https://plugins.gradle.org } ---- +Both the Maven and Gradle plugins allow the properties that are included in `git.properties` to be configured. + TIP: The commit time in `git.properties` is expected to match the following format: `yyyy-MM-dd'T'HH:mm:ssZ`. This is the default format for both plugins listed above. Using this format lets the time be parsed into a `Date` and its format, when serialized to JSON, to be controlled by Jackson's date serialization configuration settings. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc index 7c68a9fbf2..58e8fef798 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc @@ -1108,11 +1108,13 @@ Assuming you use Maven, you could rewrite the preceding example as follows: [[production-ready-application-info-git]] ==== Git Commit Information Another useful feature of the `info` endpoint is its ability to publish information about the state of your `git` source code repository when the project was built. -If a `GitProperties` bean is available, the `git.branch`, `git.commit.id`, and `git.commit.time` properties are exposed. +If a `GitProperties` bean is available, the `info` endpoint can be used to expose these properties. TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath. See "<>" for more details. +By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present. +If you don't want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file. If you want to display the full git information (that is, the full content of `git.properties`), use the configprop:management.info.git.mode[] property, as follows: [source,properties,indent=0,configprops]