映射 (mappings)
mappings 端点提供有关应用程序请求映射的信息。
检索映射
要检索映射,向 /actuator/mappings 发送一个 GET 请求,如下所示的基于 curl 的示例:
$ curl 'http://localhost:43879/actuator/mappings' -i -X GET \
-H 'accept-encoding: gzip' \
-H 'user-agent: ReactorNetty/1.3.4' \
-H 'accept: */*'
生成的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 5780
Date: Thu, 19 Mar 2026 11:11:18 GMT
{
"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/0x0000000048d256c8"
}
},
"handler" : "org.springframework.boot.actuate.docs.web.mappings.MappingsEndpointServletDocumentationTests$TestConfiguration$$Lambda/0x0000000048d256c8@3c3cd3e5",
"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 映射(如果有)。 |
|
|
Dispatcher 处理程序映射(如果有)。 |
|
|
父应用上下文的 ID(如果有)。 |
contexts.*.mappings 中可能包含的条目将在以下章节中进行描述。
Dispatcher Servlet 响应结构
在使用 Spring MVC 时,响应包含 DispatcherServlet 请求映射的详细信息,这些映射位于 contexts.*.mappings.dispatcherServlets 下。
下表描述了响应中这一部分的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
|
|
Dispatcher servlet 映射(如果有),以 dispatcher servlet bean 名称为键。 |
|
|
关于映射的其他特定于实现的详细信息。可选。 |
|
|
映射的处理器。 |
|
|
映射的谓词。 |
|
|
处理此映射请求的函数(如果有)的详细信息。 |
|
|
函数的类的完全限定名。 |
|
|
处理此映射请求的方法的详细信息(如果有)。 |
|
|
方法的类的完全限定名。 |
|
|
方法名称。 |
|
|
Java 语言规范中指定的方法描述符。 |
|
|
请求映射条件的详细信息。 |
|
|
consumes 条件的详细信息 |
|
|
消费的媒体类型。 |
|
|
媒体类型是否被否定。 |
|
|
标头条件的详细信息。 |
|
|
标头名称。 |
|
|
标头的必需值(如果有)。 |
|
|
该值是否被取反。 |
|
|
处理的 HTTP 方法。 |
|
|
params 条件的详细信息。 |
|
|
参数名称。 |
|
|
参数的必需值(如果有)。 |
|
|
该值是否被取反。 |
|
|
用于标识映射所处理路径的模式。 |
|
|
produces 条件的详细信息。 |
|
|
生成的媒体类型。 |
|
|
媒体类型是否被否定。 |
Servlet 响应结构
在使用 Servlet 堆栈时,响应包含 contexts.*.mappings.servlets 下任何 Servlet 映射的详细信息。
下表描述了响应中这一部分的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
|
|
Servlet 的映射。 |
|
|
Servlet 的名称。 |
|
|
Servlet 的类名 |
Servlet 过滤器响应结构
在使用 Servlet 堆栈时,响应包含 contexts.*.mappings.servletFilters 下任何 Filter 映射的详细信息。
下表描述了响应中这一部分的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
|
|
过滤器映射到的 Servlet 名称。 |
|
|
过滤器映射到的 URL 模式。 |
|
|
过滤器的名称。 |
|
|
过滤器的类名 |
调度器处理响应结构
在使用 Spring WebFlux 时,响应包含 DispatcherHandler 请求映射的详细信息,位于 contexts.*.mappings.dispatcherHandlers 下。
下表描述了该部分响应的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
|
|
Dispatcher 处理器映射(如果有),以 Dispatcher 处理器 Bean 名称为键。 |
|
|
关于映射的其他特定于实现的详细信息。可选。 |
|
|
映射的处理器。 |
|
|
映射的谓词。 |
|
|
请求映射条件的详细信息。 |
|
|
consumes 条件的详细信息 |
|
|
消费的媒体类型。 |
|
|
媒体类型是否被否定。 |
|
|
标头条件的详细信息。 |
|
|
标头名称。 |
|
|
标头的必需值(如果有)。 |
|
|
该值是否被取反。 |
|
|
处理的 HTTP 方法。 |
|
|
params 条件的详细信息。 |
|
|
参数名称。 |
|
|
参数的必需值(如果有)。 |
|
|
该值是否被取反。 |
|
|
用于标识映射所处理路径的模式。 |
|
|
produces 条件的详细信息。 |
|
|
生成的媒体类型。 |
|
|
媒体类型是否被否定。 |
|
|
处理此映射请求的方法的详细信息(如果有)。 |
|
|
方法的类的完全限定名。 |
|
|
方法名称。 |
|
|
Java 语言规范中指定的方法描述符。 |
|
|
处理此映射请求的函数(如果有)的详细信息。 |
|
|
函数的类的完全限定名。 |