配置属性 (configprops)

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

检索所有 @ConfigurationProperties Bean

要检索所有 @ConfigurationProperties bean,请向 /actuator/configprops 发出 GET 请求,如以下基于 curl 的示例所示

$ curl 'https://:8080/actuator/configprops' -i -X GET

结果响应类似于以下内容

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 4124

{
  "contexts" : {
    "application" : {
      "beans" : {
        "management.endpoints.web.cors-org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties" : {
          "inputs" : {
            "allowedHeaders" : [ ],
            "allowedMethods" : [ ],
            "allowedOrigins" : [ ],
            "maxAge" : { },
            "exposedHeaders" : [ ],
            "allowedOriginPatterns" : [ ]
          },
          "prefix" : "management.endpoints.web.cors",
          "properties" : {
            "allowedHeaders" : [ ],
            "allowedMethods" : [ ],
            "allowedOrigins" : [ ],
            "maxAge" : "PT30M",
            "exposedHeaders" : [ ],
            "allowedOriginPatterns" : [ ]
          }
        },
        "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" : {
          "inputs" : {
            "pathMapping" : { },
            "basePath" : { },
            "exposure" : {
              "exclude" : [ ],
              "include" : [ {
                "value" : "*",
                "origin" : "\"management.endpoints.web.exposure.include\" from property source \"Inlined Test Properties\""
              } ]
            },
            "discovery" : {
              "enabled" : { }
            }
          },
          "prefix" : "management.endpoints.web",
          "properties" : {
            "pathMapping" : { },
            "basePath" : "/actuator",
            "exposure" : {
              "exclude" : [ ],
              "include" : [ "*" ]
            },
            "discovery" : {
              "enabled" : true
            }
          }
        },
        "spring.web-org.springframework.boot.autoconfigure.web.WebProperties" : {
          "inputs" : {
            "error" : {
              "includeBindingErrors" : { },
              "includeException" : { },
              "includeMessage" : { },
              "includePath" : { },
              "includeStacktrace" : { },
              "path" : { },
              "whitelabel" : {
                "enabled" : { }
              }
            },
            "localeResolver" : { },
            "resources" : {
              "addMappings" : { },
              "cache" : {
                "cachecontrol" : { },
                "useLastModified" : { }
              },
              "chain" : {
                "cache" : { },
                "compressed" : { },
                "strategy" : {
                  "content" : {
                    "enabled" : { },
                    "paths" : [ { } ]
                  },
                  "fixed" : {
                    "enabled" : { },
                    "paths" : [ { } ]
                  }
                }
              },
              "staticLocations" : [ { }, { }, { }, { } ]
            }
          },
          "prefix" : "spring.web",
          "properties" : {
            "error" : {
              "includeBindingErrors" : "NEVER",
              "includeException" : false,
              "includeMessage" : "NEVER",
              "includePath" : "ALWAYS",
              "includeStacktrace" : "NEVER",
              "path" : "/error",
              "whitelabel" : {
                "enabled" : true
              }
            },
            "localeResolver" : "ACCEPT_HEADER",
            "resources" : {
              "addMappings" : true,
              "cache" : {
                "cachecontrol" : { },
                "useLastModified" : true
              },
              "chain" : {
                "cache" : true,
                "compressed" : false,
                "strategy" : {
                  "content" : {
                    "enabled" : false,
                    "paths" : [ "/**" ]
                  },
                  "fixed" : {
                    "enabled" : false,
                    "paths" : [ "/**" ]
                  }
                }
              },
              "staticLocations" : [ "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" ]
            }
          }
        }
      }
    }
  }
}

响应结构

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

路径 类型 描述

contexts

对象

按 ID 键控的应用程序上下文。

contexts.*.beans.*

对象

以 bean 名称为键的 @ConfigurationProperties bean。

contexts.*.beans.*.prefix

字符串

应用于 bean 属性名称的前缀。

contexts.*.beans.*.properties

对象

以名称-值对形式表示的 bean 属性。

contexts.*.beans.*.inputs

对象

绑定到此 bean 时使用的配置属性的来源和值。

contexts.*.parentId

字符串

父应用程序上下文的 ID(如果有)。

按前缀检索 @ConfigurationProperties Bean

要检索映射在特定前缀下的 @ConfigurationProperties bean,请向 /actuator/configprops/{prefix} 发出 GET 请求,如以下基于 curl 的示例所示

$ curl 'https://: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: 1175

{
  "contexts" : {
    "application" : {
      "beans" : {
        "spring.jackson-org.springframework.boot.jackson.autoconfigure.JacksonProperties" : {
          "inputs" : {
            "findAndAddModules" : { },
            "serialization" : { },
            "visibility" : { },
            "datatype" : {
              "datetime" : { },
              "enum" : { },
              "jsonNode" : { }
            },
            "deserialization" : { },
            "json" : {
              "read" : { },
              "write" : { }
            },
            "mapper" : { },
            "useJackson2Defaults" : { }
          },
          "prefix" : "spring.jackson",
          "properties" : {
            "findAndAddModules" : true,
            "serialization" : { },
            "visibility" : { },
            "datatype" : {
              "datetime" : { },
              "enum" : { },
              "jsonNode" : { }
            },
            "deserialization" : { },
            "json" : {
              "read" : { },
              "write" : { }
            },
            "mapper" : { },
            "useJackson2Defaults" : false
          }
        }
      }
    }
  }
}
{prefix} 不需要精确,更通用的前缀将返回映射在该前缀根下的所有 bean。

响应结构

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

路径 类型 描述

contexts

对象

按 ID 键控的应用程序上下文。

contexts.*.beans.*

对象

以 bean 名称为键的 @ConfigurationProperties bean。

contexts.*.beans.*.prefix

字符串

应用于 bean 属性名称的前缀。

contexts.*.beans.*.properties

对象

以名称-值对形式表示的 bean 属性。

contexts.*.beans.*.inputs

对象

绑定到此 bean 时使用的配置属性的来源和值。

contexts.*.parentId

字符串

父应用程序上下文的 ID(如果有)。

© . This site is unofficial and not affiliated with VMware.