|
对于最新稳定版本,请使用 Spring Boot 4.0.4! |
Bean(beans)
beans 端点提供有关应用程序中 bean 的信息。
检索 Bean
要获取 Bean 信息,请向 GET 发送一个 /actuator/beans 请求,如下列基于 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 的详细信息。 下表描述了响应的结构:
| 路径 | 类型 | <description> </description> |
|---|---|---|
|
|
按 ID 键索引的应用程序上下文。 |
|
|
父应用上下文的 ID(如果有的话)。 |
|
|
按名称作为键存储在应用上下文中的 Bean。 |
|
|
任何别名的名称。 |
|
|
Bean 的作用域。 |
|
|
Bean 的完全限定类型。 |
|
|
定义该 Bean 的资源(如果有的话)。 |
|
|
任何依赖项的名称。 |