對映 (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)。下表描述了響應的常見元素的結構
| 路徑 | 型別 | 描述 |
|---|---|---|
|
|
按 ID 鍵控的應用程式上下文。 |
|
|
上下文中按對映型別鍵控的對映。 |
|
|
Dispatcher servlet 對映(如果有)。 |
|
|
Servlet 過濾器對映(如果有)。 |
|
|
Servlet 對映(如果有)。 |
|
|
Dispatcher handler 對映(如果有)。 |
|
|
父應用程式上下文的 ID(如果有)。 |
contexts.*.mappings 中可能找到的條目在以下部分中描述。
Dispatcher Servlets 響應結構
使用 Spring MVC 時,響應包含 contexts.*.mappings.dispatcherServlets 下任何 DispatcherServlet 請求對映的詳細資訊。下表描述了響應此部分的結構
| 路徑 | 型別 | 描述 |
|---|---|---|
|
|
Dispatcher servlet 對映(如果有),按 dispatcher servlet bean 名稱鍵控。 |
|
|
有關對映的其他特定於實現的詳細資訊。可選。 |
|
|
對映的處理程式。 |
|
|
對映的謂詞。 |
|
|
處理此對映請求的函式的詳細資訊(如果有)。 |
|
|
函式的完全限定類名。 |
|
|
處理此對映請求的方法的詳細資訊(如果有)。 |
|
|
方法的完全限定類名。 |
|
|
方法的名稱。 |
|
|
Java 語言規範中指定的方法描述符。 |
|
|
請求對映條件的詳細資訊。 |
|
|
消費條件的詳細資訊 |
|
|
消費的媒體型別。 |
|
|
媒體型別是否被否定。 |
|
|
Header 條件的詳細資訊。 |
|
|
Header 的名稱。 |
|
|
Header 的所需值(如果有)。 |
|
|
值是否被否定。 |
|
|
處理的 HTTP 方法。 |
|
|
Params 條件的詳細資訊。 |
|
|
引數的名稱。 |
|
|
引數的所需值(如果有)。 |
|
|
值是否被否定。 |
|
|
標識對映處理的路徑的模式。 |
|
|
生成條件的詳細資訊。 |
|
|
生成的媒體型別。 |
|
|
媒體型別是否被否定。 |
Servlets 響應結構
使用 Servlet 棧時,響應包含 contexts.*.mappings.servlets 下任何 Servlet 對映的詳細資訊。下表描述了響應此部分的結構
| 路徑 | 型別 | 描述 |
|---|---|---|
|
|
Servlet 的對映。 |
|
|
Servlet 的名稱。 |
|
|
Servlet 的類名 |
Servlet 過濾器響應結構
使用 Servlet 棧時,響應包含 contexts.*.mappings.servletFilters 下任何 Filter 對映的詳細資訊。下表描述了響應此部分的結構
| 路徑 | 型別 | 描述 |
|---|---|---|
|
|
過濾器對映到的 Servlet 的名稱。 |
|
|
過濾器對映到的 URL 模式。 |
|
|
過濾器的名稱。 |
|
|
過濾器的類名 |
Dispatcher Handlers 響應結構
使用 Spring WebFlux 時,響應包含 contexts.*.mappings.dispatcherHandlers 下任何 DispatcherHandler 請求對映的詳細資訊。下表描述了響應此部分的結構
| 路徑 | 型別 | 描述 |
|---|---|---|
|
|
Dispatcher handler 對映(如果有),按 dispatcher handler bean 名稱鍵控。 |
|
|
有關對映的其他特定於實現的詳細資訊。可選。 |
|
|
對映的處理程式。 |
|
|
對映的謂詞。 |
|
|
請求對映條件的詳細資訊。 |
|
|
消費條件的詳細資訊 |
|
|
消費的媒體型別。 |
|
|
媒體型別是否被否定。 |
|
|
Header 條件的詳細資訊。 |
|
|
Header 的名稱。 |
|
|
Header 的所需值(如果有)。 |
|
|
值是否被否定。 |
|
|
處理的 HTTP 方法。 |
|
|
Params 條件的詳細資訊。 |
|
|
引數的名稱。 |
|
|
引數的所需值(如果有)。 |
|
|
值是否被否定。 |
|
|
標識對映處理的路徑的模式。 |
|
|
生成條件的詳細資訊。 |
|
|
生成的媒體型別。 |
|
|
媒體型別是否被否定。 |
|
|
處理此對映請求的方法的詳細資訊(如果有)。 |
|
|
方法的完全限定類名。 |
|
|
方法的名稱。 |
|
|
Java 語言規範中指定的方法描述符。 |
|
|
處理此對映請求的函式的詳細資訊(如果有)。 |
|
|
函式的完全限定類名。 |