跳到主要内容
版本:3.5.10

Beans(beans

QWen Max 中英对照 Beans (beans) 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" : [ ]
}
}
}
}
}

响应结构

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

路径(Path)类型(Type)描述(Description)
contextsObject以 id 为键的应用程序上下文。
contexts.*.parentIdString父应用程序上下文的 id(如果存在)。
contexts.*.beansObject应用程序上下文中以名称为键的 Bean。
contexts.*.beans.*.aliasesArray任意别名的名称。
contexts.*.beans.*.scopeStringBean 的作用域。
contexts.*.beans.*.typeStringBean 的全限定类型。
contexts.*.beans.*.resourceString定义该 Bean 的资源(如果存在)。
contexts.*.beans.*.dependenciesArray任意依赖项的名称。