以上为部分类关系图
spring 4.3.14
疑问一 url请求是如何对应到具体类上的
入口DispatchServlet
调用链
DIspatchServlet.doDispatch
DispatchServlet.getHandler
AbstractHandlerMapping.getHandler
AbstractHandlerMethodMapping.getHandlerInternal
AbstractHandlerMethodMapping.lookupHandlerMethod
AbstractHandlerMethodMapping.addMatchingMappings
此处根据请求url返回对应的类
疑问二 url与对应类的map是何时存入的
入口ContextLoaderListener
调用链
ContextLoaderListener.contextInitialized
ContextLoader.initWebApplicationContext
ContextLoader.configureAndRefreshWebApplicationContext
AbstractApplicationContext.refresh
AbstractApplicationContext.finishBeanFactoryInitialization
DefaultListableBeanFactory.preInstantiateSingletons
AbstractBeanFactory.getBean
AbstractBeanFactory.doGetBean
DefaultSingletonBeanRegistry.getSingleton
AbstractBeanFactory.getObject
AbstractAutowireCapableBeanFactory.createBean
AbstractAutowireCapableBeanFactory.doCreateBean
AbstractAutowireCapableBeanFactory.createBeanInstance
AbstractAutowireCapableBeanFactory.autowireConstructor
ConstructorResolver.autowireConstructor
ConstructorResolver.createArgumentArray
ConstructorResolver.resolveAutowiredArgument
ConstructorResolver.resolveDependency
DefaultListableBeanFactory.doResolveDependency
DefaultListableBeanFactory.resolveMultipleBeans
DefaultListableBeanFactory.findAutowireCandidates
DefaultListableBeanFactory.addCandidateEntry
DependencyDescriptor.resolveCandidate
AbstractAutowireCapableBeanFactory.initializeBean
AbstractAutowireCapableBeanFactory.invokeInitMethods
RequestMappingHandlerMapping.afterPropertiesSet
AbstractHandlerMethodMapping.afterPropertiesSet
AbstractHandlerMethodMapping.initHandlerMethods
AbstractHandlerMethodMapping.detectHandlerMethods
AbstractHandlerMethodMapping.registerHandlerMethod
AbstractHandlerMethodMapping$MappingRegistry.register
此处将url与对应类关系存入map中
疑问三 url与对应类是怎么关联到一起的
此处handler为beanName,通过beanName解析出的methods已经关联在一起
疑问四 啥时候获取注解的参数
调用链
AbstractHandlerMethodMapping.detectHandlerMethods
MethodIntrospector.selectMethods
ReflectionUtils.doWithMethods
MethodIntrospector$1.doWith
AbstractHandlerMethodMapping$1.inspect
RequestMappingHandlerMapping.getMappingForMethod
RequestMappingHandlerMapping.createRequestMappingInfo