集成 Actuator
如果存在 META-INF/build-info.properties
文件,Spring Boot Actuator 会显示与构建相关的信息。
build-info
目标会生成这样一个文件,包含项目的坐标和构建时间。
它还允许你添加任意数量的附加属性,如下例所示:
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>build-info</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.version>${java.version}</java.version>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
该配置会在预期位置生成一个带有三个附加键的 build-info.properties
文件。
java.version 需要是项目中可用的常规属性。
它会如你所预期地被插值。
|
spring-boot:build-info
org.springframework.boot:spring-boot-maven-plugin:3.5.0
Generate a build-info.properties
file based on the content of the current MavenProject
.
Optional parameters
Name | Type | Default |
---|---|---|
|
||
|
||
|
|
|
|
|
|
|
|
Parameter details
additionalProperties
Additional properties to store in the build-info.properties
file. Each entry is prefixed by build.
in the generated build-info.properties
.
Name |
|
---|---|
Type |
|
Default value |
|
User property |
|
Since |
excludeInfoProperties
Properties that should be excluded build-info.properties
file. Can be used to exclude the standard group
, artifact
, name
, version
or time
properties as well as items from additionalProperties
.
Name |
|
---|---|
Type |
|
Default value |
|
User property |
|
Since |
outputFile
The location of the generated build-info.properties
file.
Name |
|
---|---|
Type |
|
Default value |
|
User property |
|
Since |
skip
Skip the execution.
Name |
|
---|---|
Type |
|
Default value |
|
User property |
|
Since |
|
time
The value used for the build.time
property in a form suitable for Instant#parse(CharSequence)
. Defaults to project.build.outputTimestamp
or session.request.startTime
if the former is not set. To disable the build.time
property entirely, use 'off'
or add it to excludeInfoProperties
.
Name |
|
---|---|
Type |
|
Default value |
|
User property |
|
Since |
|