Polish info contributor feature

This commit improves the `InfoContributor` infrastructure as follows:

* `InfoEndpoint` no longer breaks its public API and returns a Map as
before
* `Info` is now immutable
* All properties of the build are now displayed. Since we control the
generation of that file, there is no longer a mode to restrict what's
shown
* Build info is now generated in `META-INF/build-info.properties` by
default

Closes gh-5734
This commit is contained in:
Stephane Nicoll
2016-05-06 10:52:26 +02:00
parent a1413bdb2d
commit 21536f64e1
22 changed files with 93 additions and 84 deletions

View File

@@ -86,7 +86,7 @@ content into your application; rather pick only the properties that you need.
spring.hazelcast.config= # The location of the configuration file to use to initialize Hazelcast.
# PROJECT INFORMATION ({sc-spring-boot-autoconfigure}/info/ProjectInfoProperties.{sc-ext}[ProjectInfoProperties])
spring.info.build.location=classpath:META-INF/boot/build.properties # Location of the generated build.properties file.
spring.info.build.location=classpath:META-INF/build-info.properties # Location of the generated build-info.properties file.
spring.info.git.location=classpath:git.properties # Location of the generated git.properties file.
# JMX
@@ -1015,7 +1015,6 @@ content into your application; rather pick only the properties that you need.
# INFO CONTRIBUTORS ({sc-spring-boot-actuator}/autoconfigure/InfoContributorProperties.{sc-ext}[InfoContributorProperties])
management.info.build.enabled=true # Enable build info.
management.info.build.mode=simple # Mode to use to expose build information.
management.info.defaults.enabled=true # Enable default info contributors.
management.info.env.enabled=true # Enable environment info.
management.info.git.enabled=true # Enable git info.

View File

@@ -393,7 +393,7 @@ The following `InfoContributors` are auto-configured by Spring Boot when appropr
|Expose git information if a `git.properties` file is available.
|{sc-spring-boot-actuator}/info/BuildInfoContributor.{sc-ext}[`BuildInfoContributor`]
|Expose build information if a `META-INF/boot/build.properties` file is available.
|Expose build information if a `META-INF/build-info.properties` file is available.
|===
TIP: It is possible to disable them all using the `management.info.defaults.enabled`
@@ -453,19 +453,12 @@ If you want to display the full git information (i.e. the full content of
[[production-ready-application-info-build]]
==== Build information
The `info` endpoint can also publish information about your build if a `BuildProperties`
bean is available. This happens if a `META-INF/boot/build.properties` file is available
bean is available. This happens if a `META-INF/build-info.properties` file is available
in the classpath.
TIP: The Maven and Gradle plugins can both generate that file, see
<<howto.adoc#howto-build-info,Generate build information>> for more details.
If additional properties are present they are not exposed unless configured explicitly:
[source,properties,indent=0]
----
management.info.build.mode=full
----
[[production-ready-application-info-custom]]
==== Writing custom InfoContributors