Description
The mappings endpoint is currently described as returning "a collated list of all @RequestMapping
paths". It actually returns more than that as it introspects any AbstractUrlHandlerMapping
and AbstractHandlerMethodMapping
instances, not just those that are associated with @RequestMapping
. However, there are some mappings that it doesn't currently return such as those configured by Spring Data REST.
Beyond the accuracy of the description, the content of the response is a little haphazard. It currently looks like this:
{
"/**": {
"bean": "resourceHandlerMapping"
},
"/**/favicon.ico": {
"bean": "faviconHandlerMapping"
},
"/webjars/**": {
"bean": "resourceHandlerMapping"
},
"{[/application/auditevents],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}": {
"bean": "webEndpointServletHandlerMapping",
"method": "public java.lang.Object org.springframework.boot.endpoint.web.mvc.WebEndpointServletHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)"
},
"{[/application/autoconfig],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}": {
"bean": "webEndpointServletHandlerMapping",
"method": "public java.lang.Object org.springframework.boot.endpoint.web.mvc.WebEndpointServletHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)"
},
"{[/application/beans],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}": {
"bean": "webEndpointServletHandlerMapping",
"method": "public java.lang.Object org.springframework.boot.endpoint.web.mvc.WebEndpointServletHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)"
}
// …
}
The keys in the map are just the toString()
of the mapping object which can, essentially, be anything. As such, there's no guarantee of the format of the key. There's also, as far as I know, no guarantee that the keys will be unique across everything that's introspected so entries in the map may clash. Lastly, handler mappings are ordered and this ordering is lost by using a map.
We also need to figure out what, if anything, we want to do for WebFlux and Jersey. Perhaps they should be completely separate endpoints? However, if you're using a combination of MVC and Jersey it might be nice to have all mappings available from a single source.