Beans (beans)

beans 端点提供有关应用程序 beans 的信息。

获取 Beans

要获取 beans,向 /actuator/beans 发送 GET 请求,如下面的基于 curl 的示例所示:

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

响应结果类似于以下内容:

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

{
  "contexts" : {
    "application" : {
      "beans" : {
        "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration" : {
          "aliases" : [ ],
          "scope" : "singleton",
          "type" : "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration",
          "dependencies" : [ ]
        },
        "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration" : {
          "aliases" : [ ],
          "scope" : "singleton",
          "type" : "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration",
          "dependencies" : [ ]
        },
        "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration" : {
          "aliases" : [ ],
          "scope" : "singleton",
          "type" : "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration",
          "dependencies" : [ ]
        }
      }
    }
  }
}

响应结构

响应包含应用程序 beans 的详细信息。 下表描述了响应的结构:

Path Type Description

contexts

Object

Application contexts keyed by id.

contexts.*.parentId

String

Id of the parent application context, if any.

contexts.*.beans

Object

Beans in the application context keyed by name.

contexts.*.beans.*.aliases

Array

Names of any aliases.

contexts.*.beans.*.scope

String

Scope of the bean.

contexts.*.beans.*.type

String

Fully qualified type of the bean.

contexts.*.beans.*.resource

String

Resource in which the bean was defined, if any.

contexts.*.beans.*.dependencies

Array

Names of any dependencies.