mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge branch '1.1.x'
This commit is contained in:
commit
8deb88b3c0
@ -195,9 +195,20 @@ exposed. For example, you could add the following to your `application.propertie
|
||||
info.app.version=1.0.0
|
||||
----
|
||||
|
||||
If you are using Maven, you can automatically expand info properties from the Maven
|
||||
project using resource filtering. In your `pom.xml` you have (inside the `<build/>`
|
||||
element):
|
||||
|
||||
|
||||
[[production-ready-application-info-automatic-expansion]]
|
||||
==== Automatically expand info properties at build time
|
||||
Rather than hardcoding some properties that are also specified in your project's
|
||||
build configuration, you can automatically expand info properties using the
|
||||
existing build configuration instead. This is possible in both Maven and Gradle.
|
||||
|
||||
|
||||
|
||||
[[production-ready-application-info-automatic-expansion-maven]]
|
||||
===== Automatic property expansion using Maven
|
||||
You can automatically expand info properties from the Maven project using resource
|
||||
filtering. In your `pom.xml` you have (inside the `<build/>` element):
|
||||
|
||||
[source,xml,indent=0]
|
||||
----
|
||||
@ -228,6 +239,29 @@ fallbacks if the Maven resource filtering has not been switched on for some reas
|
||||
|
||||
|
||||
|
||||
[[production-ready-application-info-automatic-expansion-gradle]]
|
||||
===== Automatic property expansion using Gradle
|
||||
You can automatically expand info properties from the Gradle project by configuring
|
||||
the Java plugin's `processResources` task to do so:
|
||||
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
processResources {
|
||||
expand(project.properties)
|
||||
}
|
||||
----
|
||||
|
||||
You can then refer to your Gradle project's properties via placeholders, e.g.
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
info.build.name=${name}
|
||||
info.build.description=${description}
|
||||
info.build.version=${version}
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[production-ready-git-commit-information]]
|
||||
==== Git commit information
|
||||
Another useful feature of the `info` endpoint is its ability to publish information
|
||||
|
Loading…
Reference in New Issue
Block a user