Skip to content

Commit 302ba77

Browse files
committed
Improve documentation regarding git commit info
Closes gh-24205
1 parent c9a09cf commit 302ba77

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,8 @@ Gradle users can achieve the same result by using the https://plugins.gradle.org
25352535
}
25362536
----
25372537

2538+
Both the Maven and Gradle plugins allow the properties that are included in `git.properties` to be configured.
2539+
25382540
TIP: The commit time in `git.properties` is expected to match the following format: `yyyy-MM-dd'T'HH:mm:ssZ`.
25392541
This is the default format for both plugins listed above.
25402542
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.

spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,11 +1108,13 @@ Assuming you use Maven, you could rewrite the preceding example as follows:
11081108
[[production-ready-application-info-git]]
11091109
==== Git Commit Information
11101110
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.
1111-
If a `GitProperties` bean is available, the `git.branch`, `git.commit.id`, and `git.commit.time` properties are exposed.
1111+
If a `GitProperties` bean is available, the `info` endpoint can be used to expose these properties.
11121112

11131113
TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath.
11141114
See "<<howto.adoc#howto-git-info,Generate git information>>" for more details.
11151115

1116+
By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present.
1117+
If you don't want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file.
11161118
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:
11171119

11181120
[source,properties,indent=0,configprops]

0 commit comments

Comments
 (0)