映射 (mappings)

mappings 端点提供有关应用程序请求映射的信息。

检索映射

要检索映射,请向 /actuator/mappings 发送 GET 请求,如以下基于 curl 的示例所示

$ curl 'https://:39533/actuator/mappings' -i -X GET \
    -H 'accept-encoding: gzip' \
    -H 'user-agent: ReactorNetty/1.3.0' \
    -H 'accept: */*'

结果响应类似于以下内容

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Transfer-Encoding: chunked
Date: Thu, 20 Nov 2025 16:34:06 GMT
Content-Length: 5780

{
  "contexts" : {
    "application" : {
      "mappings" : {
        "dispatcherServlets" : {
          "dispatcherServlet" : [ {
            "details" : {
              "handlerMethod" : {
                "className" : "org.springframework.boot.webmvc.actuate.endpoint.web.AbstractWebMvcEndpointHandlerMapping.OperationHandler",
                "descriptor" : "(Ljakarta/servlet/http/HttpServletRequest;Ljava/util/Map;)Ljava/lang/Object;",
                "name" : "handle"
              },
              "requestMappingConditions" : {
                "consumes" : [ ],
                "headers" : [ ],
                "methods" : [ "GET" ],
                "params" : [ ],
                "patterns" : [ "/actuator/mappings" ],
                "produces" : [ {
                  "mediaType" : "application/vnd.spring-boot.actuator.v3+json",
                  "negated" : false
                }, {
                  "mediaType" : "application/vnd.spring-boot.actuator.v2+json",
                  "negated" : false
                }, {
                  "mediaType" : "application/json",
                  "negated" : false
                } ]
              }
            },
            "handler" : "Actuator web endpoint 'mappings'",
            "predicate" : "{GET [/actuator/mappings], produces [application/vnd.spring-boot.actuator.v3+json || application/vnd.spring-boot.actuator.v2+json || application/json]}"
          }, {
            "details" : {
              "handlerMethod" : {
                "className" : "org.springframework.boot.webmvc.actuate.endpoint.web.WebMvcEndpointHandlerMapping.WebMvcLinksHandler",
                "descriptor" : "(Ljakarta/servlet/http/HttpServletRequest;Ljakarta/servlet/http/HttpServletResponse;)Ljava/util/Map;",
                "name" : "links"
              },
              "requestMappingConditions" : {
                "consumes" : [ ],
                "headers" : [ ],
                "methods" : [ "GET" ],
                "params" : [ ],
                "patterns" : [ "/actuator" ],
                "produces" : [ {
                  "mediaType" : "application/vnd.spring-boot.actuator.v3+json",
                  "negated" : false
                }, {
                  "mediaType" : "application/vnd.spring-boot.actuator.v2+json",
                  "negated" : false
                }, {
                  "mediaType" : "application/json",
                  "negated" : false
                } ]
              }
            },
            "handler" : "Actuator root web endpoint",
            "predicate" : "{GET [/actuator], produces [application/vnd.spring-boot.actuator.v3+json || application/vnd.spring-boot.actuator.v2+json || application/json]}"
          }, {
            "details" : {
              "handlerFunction" : {
                "className" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$TestConfiguration$$Lambda/0x0000000007a54a10"
              }
            },
            "handler" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$TestConfiguration$$Lambda/0x0000000007a54a10@1b39b5a1",
            "predicate" : "(GET && /foo)"
          }, {
            "details" : {
              "handlerMethod" : {
                "className" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests.ExampleController",
                "descriptor" : "()Ljava/lang/String;",
                "name" : "example"
              },
              "requestMappingConditions" : {
                "consumes" : [ {
                  "mediaType" : "application/json",
                  "negated" : false
                }, {
                  "mediaType" : "application/xml",
                  "negated" : true
                } ],
                "headers" : [ {
                  "name" : "X-Custom",
                  "negated" : false,
                  "value" : "Foo"
                } ],
                "methods" : [ "POST" ],
                "params" : [ {
                  "name" : "a",
                  "negated" : true,
                  "value" : "alpha"
                } ],
                "patterns" : [ "/" ],
                "produces" : [ {
                  "mediaType" : "text/plain",
                  "negated" : false
                } ]
              }
            },
            "handler" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$ExampleController#example()",
            "predicate" : "{POST [/], params [a!=alpha], headers [X-Custom=Foo], consumes [application/json || !application/xml], produces [text/plain]}"
          }, {
            "handler" : "ResourceHttpRequestHandler [classpath [META-INF/resources/webjars/]]",
            "predicate" : "/webjars/**"
          }, {
            "handler" : "ResourceHttpRequestHandler [classpath [META-INF/resources/], classpath [resources/], classpath [static/], classpath [public/], ServletContext [/]]",
            "predicate" : "/**"
          } ]
        },
        "servletFilters" : [ {
          "className" : "org.springframework.boot.servlet.filter.OrderedRequestContextFilter",
          "name" : "requestContextFilter",
          "servletNameMappings" : [ ],
          "urlPatternMappings" : [ "/*" ]
        }, {
          "className" : "org.springframework.boot.servlet.filter.OrderedFormContentFilter",
          "name" : "formContentFilter",
          "servletNameMappings" : [ ],
          "urlPatternMappings" : [ "/*" ]
        } ],
        "servlets" : [ {
          "className" : "org.springframework.web.servlet.DispatcherServlet",
          "mappings" : [ "/" ],
          "name" : "dispatcherServlet"
        } ]
      }
    }
  }
}

响应结构

响应包含应用程序映射的详细信息。响应中找到的项取决于 Web 应用程序的类型(响应式或基于 Servlet)。下表描述了响应的常见元素的结构

路径 类型 描述

contexts

对象

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

contexts.*.mappings

对象

上下文中按映射类型键控的映射。

contexts.*.mappings.dispatcherServlets

对象

Dispatcher servlet 映射(如果有)。

contexts.*.mappings.servletFilters

数组

Servlet 过滤器映射(如果有)。

contexts.*.mappings.servlets

数组

Servlet 映射(如果有)。

contexts.*.mappings.dispatcherHandlers

对象

Dispatcher handler 映射(如果有)。

contexts.*.parentId

字符串

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

contexts.*.mappings 中可能找到的条目在以下部分中描述。

Dispatcher Servlets 响应结构

使用 Spring MVC 时,响应包含 contexts.*.mappings.dispatcherServlets 下任何 DispatcherServlet 请求映射的详细信息。下表描述了响应此部分的结构

路径 类型 描述

*

数组

Dispatcher servlet 映射(如果有),按 dispatcher servlet bean 名称键控。

*.[].details

对象

有关映射的其他特定于实现的详细信息。可选。

*.[].handler

字符串

映射的处理程序。

*.[].predicate

字符串

映射的谓词。

*.[].details.handlerFunction

对象

处理此映射请求的函数的详细信息(如果有)。

*.[].details.handlerFunction.className

字符串

函数的完全限定类名。

*.[].details.handlerMethod

对象

处理此映射请求的方法的详细信息(如果有)。

*.[].details.handlerMethod.className

可变

方法的完全限定类名。

*.[].details.handlerMethod.name

可变

方法的名称。

*.[].details.handlerMethod.descriptor

可变

Java 语言规范中指定的方法描述符。

*.[].details.requestMappingConditions

对象

请求映射条件的详细信息。

*.[].details.requestMappingConditions.consumes

可变

消费条件的详细信息

*.[].details.requestMappingConditions.consumes.[].mediaType

可变

消费的媒体类型。

*.[].details.requestMappingConditions.consumes.[].negated

可变

媒体类型是否被否定。

*.[].details.requestMappingConditions.headers

可变

Header 条件的详细信息。

*.[].details.requestMappingConditions.headers.[].name

可变

Header 的名称。

*.[].details.requestMappingConditions.headers.[].value

可变

Header 的所需值(如果有)。

*.[].details.requestMappingConditions.headers.[].negated

可变

值是否被否定。

*.[].details.requestMappingConditions.methods

可变

处理的 HTTP 方法。

*.[].details.requestMappingConditions.params

可变

Params 条件的详细信息。

*.[].details.requestMappingConditions.params.[].name

可变

参数的名称。

*.[].details.requestMappingConditions.params.[].value

可变

参数的所需值(如果有)。

*.[].details.requestMappingConditions.params.[].negated

可变

值是否被否定。

*.[].details.requestMappingConditions.patterns

可变

标识映射处理的路径的模式。

*.[].details.requestMappingConditions.produces

可变

生成条件的详细信息。

*.[].details.requestMappingConditions.produces.[].mediaType

可变

生成的媒体类型。

*.[].details.requestMappingConditions.produces.[].negated

可变

媒体类型是否被否定。

Servlets 响应结构

使用 Servlet 栈时,响应包含 contexts.*.mappings.servlets 下任何 Servlet 映射的详细信息。下表描述了响应此部分的结构

路径 类型 描述

[].mappings

数组

Servlet 的映射。

[].name

字符串

Servlet 的名称。

[].className

字符串

Servlet 的类名

Servlet 过滤器响应结构

使用 Servlet 栈时,响应包含 contexts.*.mappings.servletFilters 下任何 Filter 映射的详细信息。下表描述了响应此部分的结构

路径 类型 描述

[].servletNameMappings

数组

过滤器映射到的 Servlet 的名称。

[].urlPatternMappings

数组

过滤器映射到的 URL 模式。

[].name

字符串

过滤器的名称。

[].className

字符串

过滤器的类名

Dispatcher Handlers 响应结构

使用 Spring WebFlux 时,响应包含 contexts.*.mappings.dispatcherHandlers 下任何 DispatcherHandler 请求映射的详细信息。下表描述了响应此部分的结构

路径 类型 描述

*

数组

Dispatcher handler 映射(如果有),按 dispatcher handler bean 名称键控。

*.[].details

对象

有关映射的其他特定于实现的详细信息。可选。

*.[].handler

字符串

映射的处理程序。

*.[].predicate

字符串

映射的谓词。

*.[].details.requestMappingConditions

对象

请求映射条件的详细信息。

*.[].details.requestMappingConditions.consumes

可变

消费条件的详细信息

*.[].details.requestMappingConditions.consumes.[].mediaType

可变

消费的媒体类型。

*.[].details.requestMappingConditions.consumes.[].negated

可变

媒体类型是否被否定。

*.[].details.requestMappingConditions.headers

可变

Header 条件的详细信息。

*.[].details.requestMappingConditions.headers.[].name

可变

Header 的名称。

*.[].details.requestMappingConditions.headers.[].value

可变

Header 的所需值(如果有)。

*.[].details.requestMappingConditions.headers.[].negated

可变

值是否被否定。

*.[].details.requestMappingConditions.methods

可变

处理的 HTTP 方法。

*.[].details.requestMappingConditions.params

可变

Params 条件的详细信息。

*.[].details.requestMappingConditions.params.[].name

可变

参数的名称。

*.[].details.requestMappingConditions.params.[].value

可变

参数的所需值(如果有)。

*.[].details.requestMappingConditions.params.[].negated

可变

值是否被否定。

*.[].details.requestMappingConditions.patterns

可变

标识映射处理的路径的模式。

*.[].details.requestMappingConditions.produces

可变

生成条件的详细信息。

*.[].details.requestMappingConditions.produces.[].mediaType

可变

生成的媒体类型。

*.[].details.requestMappingConditions.produces.[].negated

可变

媒体类型是否被否定。

*.[].details.handlerMethod

对象

处理此映射请求的方法的详细信息(如果有)。

*.[].details.handlerMethod.className

字符串

方法的完全限定类名。

*.[].details.handlerMethod.name

字符串

方法的名称。

*.[].details.handlerMethod.descriptor

字符串

Java 语言规范中指定的方法描述符。

*.[].details.handlerFunction

对象

处理此映射请求的函数的详细信息(如果有)。

*.[].details.handlerFunction.className

字符串

函数的完全限定类名。

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