配置属性 (configprops)

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

获取所有 @ConfigurationProperties Beans

要获取所有的 @ConfigurationProperties beans,向 /actuator/configprops 发送 GET 请求,如下面的基于 curl 的示例所示:

$ 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" : {
            "allowedHeaders" : [ ],
            "allowedMethods" : [ ],
            "allowedOrigins" : [ ],
            "maxAge" : "PT30M",
            "exposedHeaders" : [ ],
            "allowedOriginPatterns" : [ ]
          },
          "inputs" : {
            "allowedHeaders" : [ ],
            "allowedMethods" : [ ],
            "allowedOrigins" : [ ],
            "maxAge" : { },
            "exposedHeaders" : [ ],
            "allowedOriginPatterns" : [ ]
          }
        },
        "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 的详细信息。 下表描述了响应的结构:

Path Type Description

contexts

Object

Application contexts keyed by id.

contexts.*.beans.*

Object

@ConfigurationProperties beans keyed by bean name.

contexts.*.beans.*.prefix

String

Prefix applied to the names of the bean’s properties.

contexts.*.beans.*.properties

Object

Properties of the bean as name-value pairs.

contexts.*.beans.*.inputs

Object

Origin and value of the configuration property used when binding to this bean.

contexts.*.parentId

String

Id of the parent application context, if any.

通过前缀获取 @ConfigurationProperties Beans

要获取映射在特定前缀下的 @ConfigurationProperties beans,向 /actuator/configprops/{prefix} 发送 GET 请求,如下面的基于 curl 的示例所示:

$ 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 的详细信息。 下表描述了响应的结构:

Path Type Description

contexts

Object

Application contexts keyed by id.

contexts.*.beans.*

Object

@ConfigurationProperties beans keyed by bean name.

contexts.*.beans.*.prefix

String

Prefix applied to the names of the bean’s properties.

contexts.*.beans.*.properties

Object

Properties of the bean as name-value pairs.

contexts.*.beans.*.inputs

Object

Origin and value of the configuration property used when binding to this bean.

contexts.*.parentId

String

Id of the parent application context, if any.