跳到主要内容

配置属性 (configprops)

DeepSeek V3 中英对照 Configuration Properties (configprops)

configprops 端点提供了有关应用程序的 @ConfigurationProperties beans 的信息。

检索所有 @ConfigurationProperties Bean

要检索所有 @ConfigurationProperties 的 bean,可以向 /actuator/configprops 发送一个 GET 请求,如下面基于 curl 的示例所示:

$ curl 'http://localhost:8080/actuator/configprops' -i -X GET
bash

生成的响应类似于以下内容:

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" : { }
}
}
}
}
}
}
}
}
http

响应结构

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

路径类型描述
contextsObject按 id 键控的应用程序上下文。
contexts.*.beans.*Object按 bean 名称键控的 @ConfigurationProperties bean。
contexts.*.beans.*.prefixString应用于 bean 属性名称的前缀。
contexts.*.beans.*.propertiesObjectbean 的属性,以名称-值对的形式。
contexts.*.beans.*.inputsObject绑定到该 bean 时使用的配置属性的来源和值。
contexts.*.parentIdString父应用程序上下文的 id(如果有)。

通过前缀检索 @ConfigurationProperties Bean

要检索映射到特定前缀下的 @ConfigurationProperties bean,请向 /actuator/configprops/{prefix} 发起一个 GET 请求,如下面基于 curl 的示例所示:

$ curl 'http://localhost:8080/actuator/configprops/spring.jackson' -i -X GET
bash

生成的响应类似于以下内容:

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" : { }
}
}
}
}
}
}
http
备注

{prefix} 不需要完全匹配,一个更通用的前缀将返回映射在该前缀下的所有 bean。

响应结构

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

路径类型描述
contextsObject按 id 索引的应用程序上下文。
contexts.*.beans.*Object按 bean 名称索引的 @ConfigurationProperties bean。
contexts.*.beans.*.prefixString应用于 bean 属性名称的前缀。
contexts.*.beans.*.propertiesObjectbean 的属性,以名称-值对的形式表示。
contexts.*.beans.*.inputsObject绑定到此 bean 时使用的配置属性的来源和值。
contexts.*.parentIdString父应用程序上下文的 id(如果有)。