對映 (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.