spring debug
DispatcherServlet{
getHandler()
}
handlerMappings{
RequestMappingHandlerMapping
BeanNameUrlHandlerMapping
WebMvcConfigurationSupport
}
BeanNameUrlHandlerMapping{
determineUrlsForHandler() //加断点 可知 urlmapping有没有正确
}
RequestMappingHandlerMapping{
createRequestMappingInfo() //url成功了才到这
}
RequestMappingHandlerAdapter {
handleInternal //加断点
}
SimpleControllerHandlerAdapter,
SimplePortletHandlerAdapter
检查handlerMappings 在以下代码 启动时断点
private void initHandlerMappings(ApplicationContext context) {
this.handlerMappings = null;
if (this.detectAllHandlerMappings) {
// Find all HandlerMappings in the ApplicationContext, including ancestor contexts.
Map<String, HandlerMapping> matchingBeans =
BeanFactoryUtils.beansOfTypeIncludingAncestors(context, HandlerMapping.class, true, false);
if (!matchingBeans.isEmpty()) {
this.handlerMappings = new ArrayList<HandlerMapping>(matchingBeans.values());
// We keep HandlerMappings in sorted order.
AnnotationAwareOrderComparator.sort(this.handlerMappings);
}
}
BeanNameUrlHandlerMapping{
determineUrlsForHandler
}
RequestMappingHandlerMapping 以前的DefaultAnnotationHandlerMapping
AbstractHandlerMapping{
getHandler 真正作urlmatch
}
AbstractHandlerMethodMapping{
getHandlerInternal
protected HandlerMethod lookupHandlerMethod(String lookupPath, HttpServletRequest request) throws Exception {
List<Match> matches = new ArrayList<Match>();
List<T> directPathMatches = this.mappingRegistry.getMappingsByUrl(lookupPath);
}