與 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.4.5
根據當前 MavenProject
的內容生成一個 build-info.properties
檔案。
可選引數
名稱 | 型別 | 預設值 |
---|---|---|
|
||
|
||
|
|
|
|
|
|
|
|
引數詳情
additionalProperties
要儲存在 build-info.properties
檔案中的附加屬性。在生成的 build-info.properties
中,每個條目都以字首 build.
開頭。
名稱 |
|
---|---|
型別 |
|
預設值 |
|
使用者屬性 |
|
始於 |
excludeInfoProperties
應從 build-info.properties
檔案中排除的屬性。可用於排除標準的 group
、artifact
、name
、version
或 time
屬性以及 additionalProperties
中的項。
名稱 |
|
---|---|
型別 |
|
預設值 |
|
使用者屬性 |
|
始於 |