配置屬性 (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.