福建SEO:首先在AbstractHandlerMethodMapping中,在afterPropertiesSet这个钩子函数中,先初始化handlerMethods。

在detectHandlerMethods中,获取如下map

// key值为method value为 RequestMappingInfo 这个类标明了该方法的条件 包括url以及http方法等等信息
Map<Method, T> methods = MethodIntrospector.selectMethods(userType,
(MethodIntrospector.MetadataLookup<T>) method -> {
try {
return getMappingForMethod(method, userType);
}
catch (Throwable ex) {
throw new IllegalStateException("Invalid mapping on handler class [" +
userType.getName() + "]: " + method, ex);
}
});

注册的过程在方法中进行

// mapping 的信息  handler为该方法的bean的name method为方法
public void register(T mapping, Object handler, Method method) {
// Assert that the handler method is not a suspending one.
if (KotlinDetector.isKotlinType(method.getDeclaringClass()) && KotlinDelegate.isSuspend(method)) {
throw new IllegalStateException("Unsupported suspending handler method detected: " + method);
}
    // 先获取写锁
this.readWriteLock.writeLock().lock();
try {
HandlerMethod handlerMethod = createHandlerMethod(handler, method);
validateMethodMapping(handlerMethod, mapping);
this.mappingLookup.put(mapping, handlerMethod); List<String> directUrls = getDirectUrls(mapping);
for (String url : directUrls) {
this.urlLookup.add(url, mapping);
} String name = null;
if (getNamingStrategy() != null) {
name = getNamingStrategy().getName(handlerMethod, mapping);
addMappingName(name, handlerMethod);
} CorsConfiguration corsConfig = initCorsConfiguration(handler, method, mapping);
if (corsConfig != null) {
this.corsLookup.put(handlerMethod, corsConfig);
} this.registry.put(mapping, new MappingRegistration<>(mapping, handlerMethod, directUrls, name));
}
finally {
this.readWriteLock.writeLock().unlock();
}
}
 

springmvc register过程的更多相关文章

  1. SpringMVC启动过程详解(li)

    通过对SpringMVC启动过程的深入研究,期望掌握Java Web容器启动过程:掌握SpringMVC启动过程:了解SpringMVC的配置文件如何配置,为什么要这样配置:掌握SpringMVC是如 ...

  2. 深入源码分析SpringMVC执行过程

    本文主要讲解 SpringMVC 执行过程,并针对相关源码进行解析. 首先,让我们从 Spring MVC 的四大组件:前端控制器(DispatcherServlet).处理器映射器(HandlerM ...

  3. springmvc配置过程中遇到的一些问题总结

    springmvc配置过程中遇到的一些问题总结 1.配置tomcat过程中的错误: 2.配置web.xml中DispatchServlet报红(配置好已有依赖条件下) 解决的办法: 因为新添加依赖,m ...

  4. springMvc 启动过程

    转载自https://www.jianshu.com/p/dc64d02e49ac 这里给出一个简洁的文字描述版SpringMVC启动过程: tomcat web容器启动时会去读取web.xml这样的 ...

  5. 浅谈SpringMVC执行过程

    通过深入分析Spring源码,我们知道Spring框架包括大致六大模块, 如Web模块,数据库访问技术模块,面向切面模块,基础设施模块,核心容器模块和模块, 其中,在Spring框架的Web模块中,又 ...

  6. springMVC工作过程

    学习springmvc之前先学习一下他的工作过程 如图 1.用户通过客户端向服务器发送请求,请求会被springMVC的前端控制器DispatchServlet所拦截. 2.DispatchServl ...

  7. SpringMvc执行过程

    --Test过程: 1. 先执行各种 Filter 2. HttpServlet.service(ServletRequest req, ServletResponse res) 3. HttpSer ...

  8. Spring Taco Cloud——Controller的创建(含SpringMVC执行过程&SpringBoot&Spring三者解释及关联)

    在记录这次控制器编写前,对于Spring的感觉就是经常提这样代码好简洁,这样好方便,这个是用来干嘛的诸如之类的话. What is Spring ?这是我想问自己的,一直认为是简化代码利于工程的开源框 ...

  9. springmvc请求处理过程

    springmvc请求的处理流程 1)发起some.do 2)tomcat(web.xml-----url-pattern知道*.do的请求给DispatcherServlet) 3)Dispatch ...

随机推荐

  1. python保留小数位

    前言 保留小数位是我们经常会碰到的问题,尤其是刷题过程中.那么在python中保留小数位的方法也非常多,但是笔者的原则就是什么简单用什么,因此这里介绍几种比较简单实用的保留小数位的方法: 方法一:fo ...

  2. 新手转行必知!Python和Java到底有啥区别?

    TIOBE 9月编程语言排行榜中Java第一,但PYPL 9月排行榜中Python却是第一.两个编程语言排行榜均是旨在给开发者做一个学习参考,那么问题来了:Java和Python都很火,两个语言到底有 ...

  3. CF_448D 二分

    给定n m k n和m为一个矩阵的行和列,都从1开始,矩阵的每个元素的值即为 i*j(行*列),求里面第k个数 还想找什么规律,发现虽然矩阵里面很有规律,但是n 和m在不断变化 根本不好找 其实元素从 ...

  4. UVALive 6763 / CSU 1446

    今天比赛的时候拿到的第一道题,其实挺简单的,求两等差序列中相同元素的个数,我想了一下就觉得,只要找到了第一个相等的点,然后后面求最大公约数就可以直接得到结果了 网上叫什么拓展欧几里得,我反正是按照我们 ...

  5. redis(二)----基本操作

    1. redis介绍 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset( ...

  6. sql优化从300秒到7秒

    原始sql select b.jd 街道,b.rglm 楼宇,zzrl 楼宇编号,count(oname) 入楼企业总数, (select count(oname) from ${tablename} ...

  7. UVA 11732 链表+字典树

    因为字符集比较大,所以就不能用简单字典树,在字典树里面,用链表进行存储.这个倒是不难,练了下手 统计的时候还是有点难搞,因为要算所有的两两比较的次数之和,对分叉处进行计算,注意细节 #include ...

  8. 吴裕雄--天生自然 PHP开发学习:超级全局变量

    <!DOCTYPE html> <html> <body> <?php $x = 75; $y = 25; function addition() { $GL ...

  9. 寒假day15

    今天完成了毕设的人才动态模块,同时刷了计算机网络的相关面试题

  10. Python—数据结构——链表

    数据结构——链表 一.简介 链表是一种物理存储上非连续,数据元素的逻辑顺序通过链表中的指针链接次序,实现的一种线性存储结构.由一系列节点组成的元素集合.每个节点包含两部分,数据域item和指向下一个节 ...