| 此版本仍在开发中,尚不被认为是稳定的。对于最新的稳定版本,请使用 Spring Boot 3.5.5! | 
映射 (mappings)
这mappingsendpoint 提供有关应用程序的请求映射的信息。
检索映射
要检索映射,请将GET请求/actuator/mappings,如以下基于 curl 的示例所示:
$ curl 'http://localhost:33329/actuator/mappings' -i -X GET \
    -H 'accept-encoding: gzip' \
    -H 'user-agent: ReactorNetty/1.3.0-M6' \
    -H 'accept: */*'生成的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Transfer-Encoding: chunked
Date: Thu, 21 Aug 2025 20:12:05 GMT
Content-Length: 5780
{
  "contexts" : {
    "application" : {
      "mappings" : {
        "dispatcherServlets" : {
          "dispatcherServlet" : [ {
            "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" : {
              "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" : {
              "handlerFunction" : {
                "className" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$TestConfiguration$$Lambda/0x00007f0493a85740"
              }
            },
            "handler" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$TestConfiguration$$Lambda/0x00007f0493a85740@34463dc8",
            "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)。 下表描述了响应的公共元素的结构:
| 路径 | 类型 | 描述 | 
|---|---|---|
| 
 | 
 | 以 id 键入的应用程序上下文。 | 
| 
 | 
 | 上下文中的映射,按映射类型键控。 | 
| 
 | 
 | Dispatcher Servlet 映射(如果有)。 | 
| 
 | 
 | Servlet 过滤器映射(如果有)。 | 
| 
 | 
 | Servlet 映射(如果有)。 | 
| 
 | 
 | 调度程序处理程序映射(如果有)。 | 
| 
 | 
 | 父应用程序上下文的 ID(如果有)。 | 
可以在contexts.*.mappings将在以下部分中介绍。
Dispatcher Servlet 响应结构
使用 Spring MVC 时,响应包含任何DispatcherServlet下面的请求映射contexts.*.mappings.dispatcherServlets.
下表描述了响应的这一部分的结构:
| 路径 | 类型 | 描述 | 
|---|---|---|
| 
 | 
 | Dispatcher Servlet 映射(如果有),由 Dispatcher Servlet Bean 名称键控。 | 
| 
 | 
 | 有关映射的其他特定于实现的详细信息。自选。 | 
| 
 | 
 | 映射的处理程序。 | 
| 
 | 
 | 映射的谓词。 | 
| 
 | 
 | 将处理对此映射的请求的函数的详细信息(如果有)。 | 
| 
 | 
 | 函数类的完全限定名称。 | 
| 
 | 
 | 将处理对此映射的请求的方法的详细信息(如果有)。 | 
| 
 | 
 | 方法类的完全限定名称。 | 
| 
 | 
 | 方法的名称。 | 
| 
 | 
 | Java 语言规范中指定的方法的描述符。 | 
| 
 | 
 | 请求映射条件的详细信息。 | 
| 
 | 
 | consumes 条件的详细信息 | 
| 
 | 
 | 已使用的媒体类型。 | 
| 
 | 
 | 是否否定媒体类型。 | 
| 
 | 
 | 标头条件的详细信息。 | 
| 
 | 
 | 标头的名称。 | 
| 
 | 
 | 标头的必需值(如果有)。 | 
| 
 | 
 | 是否否定该值。 | 
| 
 | 
 | 处理的 HTTP 方法。 | 
| 
 | 
 | 参数条件的详细信息。 | 
| 
 | 
 | 参数的名称。 | 
| 
 | 
 | 参数的必需值(如果有)。 | 
| 
 | 
 | 是否否定该值。 | 
| 
 | 
 | 标识映射处理的路径的模式。 | 
| 
 | 
 | 生产条件的详细信息。 | 
| 
 | 
 | 生产的媒体类型。 | 
| 
 | 
 | 是否否定媒体类型。 | 
Servlet 响应结构
使用 Servlet 堆栈时,响应包含任何Servlet下面的映射contexts.*.mappings.servlets.
下表描述了响应的这一部分的结构:
| 路径 | 类型 | 描述 | 
|---|---|---|
| 
 | 
 | servlet 的映射。 | 
| 
 | 
 | servlet 的名称。 | 
| 
 | 
 | servlet 的类名 | 
Servlet 过滤器响应结构
使用 Servlet 堆栈时,响应包含任何Filter下面的映射contexts.*.mappings.servletFilters.
下表描述了响应的这一部分的结构:
| 路径 | 类型 | 描述 | 
|---|---|---|
| 
 | 
 | 过滤器映射到的 Servlet 的名称。 | 
| 
 | 
 | 过滤器映射到的 URL 模式。 | 
| 
 | 
 | 筛选器的名称。 | 
| 
 | 
 | 过滤器的类名 | 
调度程序处理程序响应结构
使用 Spring WebFlux 时,响应包含任何DispatcherHandler下面的请求映射contexts.*.mappings.dispatcherHandlers.
下表描述了响应的这一部分的结构:
| 路径 | 类型 | 描述 | 
|---|---|---|
| 
 | 
 | 调度程序处理程序映射(如果有),由调度程序处理程序 bean 名称键控。 | 
| 
 | 
 | 有关映射的其他特定于实现的详细信息。自选。 | 
| 
 | 
 | 映射的处理程序。 | 
| 
 | 
 | 映射的谓词。 | 
| 
 | 
 | 请求映射条件的详细信息。 | 
| 
 | 
 | consumes 条件的详细信息 | 
| 
 | 
 | 已使用的媒体类型。 | 
| 
 | 
 | 是否否定媒体类型。 | 
| 
 | 
 | 标头条件的详细信息。 | 
| 
 | 
 | 标头的名称。 | 
| 
 | 
 | 标头的必需值(如果有)。 | 
| 
 | 
 | 是否否定该值。 | 
| 
 | 
 | 处理的 HTTP 方法。 | 
| 
 | 
 | 参数条件的详细信息。 | 
| 
 | 
 | 参数的名称。 | 
| 
 | 
 | 参数的必需值(如果有)。 | 
| 
 | 
 | 是否否定该值。 | 
| 
 | 
 | 标识映射处理的路径的模式。 | 
| 
 | 
 | 生产条件的详细信息。 | 
| 
 | 
 | 生产的媒体类型。 | 
| 
 | 
 | 是否否定媒体类型。 | 
| 
 | 
 | 将处理对此映射的请求的方法的详细信息(如果有)。 | 
| 
 | 
 | 方法类的完全限定名称。 | 
| 
 | 
 | 方法的名称。 | 
| 
 | 
 | Java 语言规范中指定的方法的描述符。 | 
| 
 | 
 | 将处理对此映射的请求的函数的详细信息(如果有)。 | 
| 
 | 
 | 函数类的完全限定名称。 |