Beans (beans)

beans 端点提供了关于应用程序 Beans 的信息。

检索 Beans

要检索 Beans,可以按照以下基于 curl 的示例,向 /actuator/beans 发起一个 GET 请求:

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 的详细信息。下表描述了响应的结构:

路径

类型

描述

contexts

Object

以 ID 为键的应用程序上下文。

contexts.*.parentId

String

父应用程序上下文的 ID(如果有)。

contexts.*.beans

Object

应用程序上下文中以名称为键的 Beans。

contexts.*.beans.*.aliases

Array

任何别名的名称。

contexts.*.beans.*.scope

String

Bean 的作用域。

contexts.*.beans.*.type

String

Bean 的完全限定类型。

contexts.*.beans.*.resource

String

Bean 定义所在的资源(如果有)。

contexts.*.beans.*.dependencies

Array

任何依赖项的名称。