信息(info

info 端点提供有关应用的一般信息。

获取信息

要获取应用信息,请对 /actuator/info 发起 GET 请求,如下所示(基于 curl 的示例):

$ curl 'http://localhost:8080/actuator/info' -i -X GET

响应结果类似如下:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 1381

{
  "git" : {
    "branch" : "main",
    "commit" : {
      "id" : "df027cf",
      "time" : "2025-05-26T03:07:52Z"
    }
  },
  "build" : {
    "artifact" : "application",
    "version" : "1.0.3",
    "group" : "com.example"
  },
  "os" : {
    "name" : "Mac OS X",
    "version" : "15.4.1",
    "arch" : "aarch64"
  },
  "process" : {
    "pid" : 92365,
    "parentPid" : 85426,
    "owner" : "zhaiyongchao",
    "memory" : {
      "heap" : {
        "init" : 268435456,
        "used" : 137887776,
        "committed" : 213909504,
        "max" : 1610612736
      },
      "nonHeap" : {
        "init" : 7667712,
        "used" : 100735160,
        "committed" : 104267776,
        "max" : -1
      },
      "garbageCollectors" : [ {
        "name" : "G1 Young Generation",
        "collectionCount" : 12
      }, {
        "name" : "G1 Concurrent GC",
        "collectionCount" : 6
      }, {
        "name" : "G1 Old Generation",
        "collectionCount" : 0
      } ]
    },
    "cpus" : 10
  },
  "java" : {
    "version" : "21.0.7",
    "vendor" : {
      "name" : "Amazon.com Inc.",
      "version" : "Corretto-21.0.7.6.1"
    },
    "runtime" : {
      "name" : "OpenJDK Runtime Environment",
      "version" : "21.0.7+6-LTS"
    },
    "jvm" : {
      "name" : "OpenJDK 64-Bit Server VM",
      "vendor" : "Amazon.com Inc.",
      "version" : "21.0.7+6-LTS"
    }
  }
}

响应结构

响应包含有关应用的一般信息。 响应的每个部分都由一个 InfoContributor 提供。 Spring Boot 提供了若干贡献者,具体如下所述。

Build 响应结构

下表描述了响应中 build 部分的结构:

Path Type Description

artifact

String

Artifact ID of the application, if any.

group

String

Group ID of the application, if any.

name

String

Name of the application, if any.

version

String

Version of the application, if any.

time

Varies

Timestamp of when the application was built, if any.

Git 响应结构

下表描述了响应中 git 部分的结构:

Path Type Description

branch

String

Name of the Git branch, if any.

commit

Object

Details of the Git commit, if any.

commit.time

Varies

Timestamp of the commit, if any.

commit.id

String

ID of the commit, if any.

这是“简化”输出。 贡献者也可以配置为输出所有可用数据。

OS 响应结构

下表描述了响应中 os 部分的结构:

Path Type Description

name

String

Name of the operating system (as obtained from the 'os.name' system property).

version

String

Version of the operating system (as obtained from the 'os.version' system property).

arch

String

Architecture of the operating system (as obtained from the 'os.arch' system property).

Process 响应结构

下表描述了响应中 process 部分的结构:

Path Type Description

pid

Number

Process ID.

parentPid

Number

Parent Process ID (or -1).

owner

String

Process owner.

cpus

Number

Number of CPUs available to the process.

memory

Object

Memory information.

memory.heap

Object

Heap memory.

memory.heap.init

Number

Number of bytes initially requested by the JVM.

memory.heap.used

Number

Number of bytes currently being used.

memory.heap.committed

Number

Number of bytes committed for JVM use.

memory.heap.max

Number

Maximum number of bytes that can be used by the JVM (or -1).

memory.nonHeap

Object

Non-heap memory.

memory.nonHeap.init

Number

Number of bytes initially requested by the JVM.

memory.nonHeap.used

Number

Number of bytes currently being used.

memory.nonHeap.committed

Number

Number of bytes committed for JVM use.

memory.nonHeap.max

Number

Maximum number of bytes that can be used by the JVM (or -1).

memory.garbageCollectors

Array

Details for garbage collectors.

memory.garbageCollectors[].name

String

Name of of the garbage collector.

memory.garbageCollectors[].collectionCount

Number

Total number of collections that have occurred.

virtualThreads

Object

Virtual thread information (if VirtualThreadSchedulerMXBean is available)

virtualThreads.mounted

Number

Estimate of the number of virtual threads currently mounted by the scheduler.

virtualThreads.queued

Number

Estimate of the number of virtual threads queued to the scheduler to start or continue execution.

virtualThreads.parallelism

Number

Scheduler’s target parallelism.

virtualThreads.poolSize

Number

Current number of platform threads that the scheduler has started but have not terminated

Java 响应结构

下表描述了响应中 java 部分的结构:

Path Type Description

version

String

Java version, if available.

vendor

Object

Vendor details.

vendor.name

String

Vendor name, if available.

vendor.version

String

Vendor version, if available.

runtime

Object

Runtime details.

runtime.name

String

Runtime name, if available.

runtime.version

String

Runtime version, if available.

jvm

Object

JVM details.

jvm.name

String

JVM name, if available.

jvm.vendor

String

JVM vendor, if available.

jvm.version

String

JVM version, if available.