配置属性 (configprops)
configprops
端点提供了关于应用程序的 @ConfigurationProperties
beans 的信息。
检索所有 @ConfigurationProperties Beans
要检索所有 @ConfigurationProperties
beans,可以按照以下基于 curl 的示例,向 /actuator/configprops
发起一个 GET
请求:
curl 'http://localhost:8080/actuator/configprops' -i -X GET
返回的响应类似于以下内容:
HTTP/1.1 200 OK Content-Type: application/vnd.spring-boot.actuator.v3+json Content-Length: 3411 { "contexts" : { "application" : { "beans" : { "management.endpoints.web.cors-org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties" : { "prefix" : "management.endpoints.web.cors", "properties" : { "allowedOrigins" : [ ], "maxAge" : "PT30M", "exposedHeaders" : [ ], "allowedOriginPatterns" : [ ], "allowedHeaders" : [ ], "allowedMethods" : [ ] }, "inputs" : { "allowedOrigins" : [ ], "maxAge" : { }, "exposedHeaders" : [ ], "allowedOriginPatterns" : [ ], "allowedHeaders" : [ ], "allowedMethods" : [ ] } }, "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" : { "prefix" : "management.endpoints.web", "properties" : { "pathMapping" : { }, "exposure" : { "include" : [ "*" ], "exclude" : [ ] }, "basePath" : "/actuator", "discovery" : { "enabled" : true } }, "inputs" : { "pathMapping" : { }, "exposure" : { "include" : [ { "value" : "*", "origin" : "\"management.endpoints.web.exposure.include\" from property source \"Inlined Test Properties\"" } ], "exclude" : [ ] }, "basePath" : { }, "discovery" : { "enabled" : { } } } }, "spring.web-org.springframework.boot.autoconfigure.web.WebProperties" : { "prefix" : "spring.web", "properties" : { "localeResolver" : "ACCEPT_HEADER", "resources" : { "staticLocations" : [ "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" ], "addMappings" : true, "chain" : { "cache" : true, "compressed" : false, "strategy" : { "fixed" : { "enabled" : false, "paths" : [ "/**" ] }, "content" : { "enabled" : false, "paths" : [ "/**" ] } } }, "cache" : { "cachecontrol" : { }, "useLastModified" : true } } }, "inputs" : { "localeResolver" : { }, "resources" : { "staticLocations" : [ { }, { }, { }, { } ], "addMappings" : { }, "chain" : { "cache" : { }, "compressed" : { }, "strategy" : { "fixed" : { "enabled" : { }, "paths" : [ { } ] }, "content" : { "enabled" : { }, "paths" : [ { } ] } } }, "cache" : { "cachecontrol" : { }, "useLastModified" : { } } } } } } } } }
响应结构
响应包含应用程序 @ConfigurationProperties
beans 的详细信息。下表描述了响应的结构:
路径 |
类型 |
描述 |
|
|
以 ID 为键的应用程序上下文。 |
|
|
以 bean 名称为键的 |
|
|
应用于 bean 属性名称的前缀。 |
|
|
作为name-value对的 bean 属性。 |
|
|
绑定到该 bean 时使用的配置属性的来源和值。 |
|
|
父应用程序上下文的 ID(如果有)。 |
按前缀检索 @ConfigurationProperties Beans
要检索映射在某个前缀下的 @ConfigurationProperties
beans,可以按照以下基于 curl 的示例,向 /actuator/configprops/{prefix}
发起一个 GET
请求:
curl 'http://localhost:8080/actuator/configprops/spring.jackson' -i -X GET
返回的响应类似于以下内容:
HTTP/1.1 200 OK Content-Disposition: inline;filename=f.txt Content-Type: application/vnd.spring-boot.actuator.v3+json Content-Length: 878 { "contexts" : { "application" : { "beans" : { "spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties" : { "prefix" : "spring.jackson", "properties" : { "serialization" : { }, "visibility" : { }, "parser" : { }, "datatype" : { "jsonNode" : { }, "enum" : { } }, "deserialization" : { }, "generator" : { }, "mapper" : { } }, "inputs" : { "serialization" : { }, "visibility" : { }, "parser" : { }, "datatype" : { "jsonNode" : { }, "enum" : { } }, "deserialization" : { }, "generator" : { }, "mapper" : { } } } } } } }
{prefix} 不需要是精确的,更一般的前缀将返回所有映射在该前缀下的 beans。
|
响应结构
响应包含应用程序 @ConfigurationProperties
beans 的详细信息。下表描述了响应的结构:
路径 |
类型 |
描述 |
|
|
以 ID 为键的应用程序上下文。 |
|
|
以 bean 名称为键的 |
|
|
应用于 bean 属性名称的前缀。 |
|
|
作为name-value对的 bean 属性。 |
|
|
绑定到该 bean 时使用的配置属性的来源和值。 |
|
|
父应用程序上下文的 ID(如果有)。 |