条件评估报告(conditions)
conditions)
conditions 端点提供有关配置类和自动配置类上条件评估的信息。
获取报告
要获取该报告,请向 /actuator/conditions 发起一个 GET 请求,如下列基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/conditions' -i -X GET
得到的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 3326
{
"contexts" : {
"application" : {
"positiveMatches" : {
"EndpointAutoConfiguration#propertiesEndpointAccessResolver" : [ {
"condition" : "OnBeanCondition",
"message" : "@ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.EndpointAccessResolver; SearchStrategy: all) did not find any beans"
} ],
"EndpointAutoConfiguration#endpointOperationParameterMapper" : [ {
"condition" : "OnBeanCondition",
"message" : "@ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper; SearchStrategy: all) did not find any beans"
} ],
"EndpointAutoConfiguration#endpointCachingOperationInvokerAdvisor" : [ {
"condition" : "OnBeanCondition",
"message" : "@ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor; SearchStrategy: all) did not find any beans"
} ]
},
"negativeMatches" : {
"WebFluxEndpointManagementContextConfiguration" : {
"notMatched" : [ {
"condition" : "OnWebApplicationCondition",
"message" : "not a reactive web application"
} ],
"matched" : [ {
"condition" : "OnClassCondition",
"message" : "@ConditionalOnClass found required classes 'org.springframework.web.reactive.DispatcherHandler', 'org.springframework.http.server.reactive.HttpHandler'"
} ]
},
"GsonHttpMessageConvertersConfiguration.GsonHttpMessageConverterConfiguration" : {
"notMatched" : [ {
"condition" : "GsonHttpMessageConvertersConfiguration.PreferGsonOrJacksonAndJsonbUnavailableCondition",
"message" : "AnyNestedCondition 0 matched 2 did not; NestedCondition on GsonHttpMessageConvertersConfiguration.PreferGsonOrJacksonAndJsonbUnavailableCondition.JacksonJsonbUnavailable NoneNestedConditions 1 matched 1 did not; NestedCondition on GsonHttpMessageConvertersConfiguration.JacksonAndJsonbUnavailableCondition.JsonbPreferred @ConditionalOnPreferredJsonMapper JSONB no property was configured and Jackson is the default; NestedCondition on GsonHttpMessageConvertersConfiguration.JacksonAndJsonbUnavailableCondition.JacksonAvailable @ConditionalOnBean (types: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; SearchStrategy: all) found bean 'mappingJackson2HttpMessageConverter'; NestedCondition on GsonHttpMessageConvertersConfiguration.PreferGsonOrJacksonAndJsonbUnavailableCondition.GsonPreferred @ConditionalOnPreferredJsonMapper GSON no property was configured and Jackson is the default"
} ],
"matched" : [ ]
},
"WebMvcEndpointManagementContextConfiguration#managementHealthEndpointWebMvcHandlerMapping" : {
"notMatched" : [ {
"condition" : "OnManagementPortCondition",
"message" : "Management Port actual port type (SAME) did not match required type (DIFFERENT)"
} ],
"matched" : [ ]
}
},
"unconditionalClasses" : [ "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration", "org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration" ]
}
}
}
响应结构
响应包含应用程序条件评估的详细信息。下表描述了响应的结构:
| 路径(Path) | 类型(Type) | 描述(Description) |
|---|---|---|
contexts | Object | 以 id 为键的应用程序上下文。 |
contexts.*.positiveMatches | Object | 条件匹配成功的类和方法。 |
contexts.*.positiveMatches.*.[].condition | String | 条件的名称。 |
contexts.*.positiveMatches.*.[].message | String | 条件匹配成功的原因详情。 |
contexts.*.negativeMatches | Object | 条件未匹配的类和方法。 |
contexts.*.negativeMatches.*.notMatched | Array | 未匹配的条件。 |
contexts.*.negativeMatches.*.notMatched.[].condition | String | 条件的名称。 |
contexts.*.negativeMatches.*.notMatched.[].message | String | 条件未匹配的原因详情。 |
contexts.*.negativeMatches.*.matched | Array | 已匹配的条件。 |
contexts.*.negativeMatches.*.matched.[].condition | String | 条件的名称。 |
contexts.*.negativeMatches.*.matched.[].message | String | 条件匹配成功的原因详情。 |
contexts.*.unconditionalClasses | Array | 无条件自动配置类的名称(如果有)。 |
contexts.*.parentId | String | 父应用程序上下文的 id(如果有)。 |