Spring MVC 学习 —— <mvc:annotation-driven/>
来源:互联网 发布:ubuntu 15.10 163源 编辑:程序博客网 时间:2024/06/06 03:45
Spring MVC 解读—— mvc:annotation-driven/
<mvc:annotation-driven/>
标签,所以我们找到对应的实现类是org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser
。
通过阅读类注释文档,我们发现这个类主要是用来向工厂中注册了
RequestMappingHandlerMapping
BeanNameUrlHandlerMapping
RequestMappingHandlerAdapter
HttpRequestHandlerAdapter
SimpleControllerHandlerAdapter
ExceptionHandlerExceptionResolver
ResponseStatusExceptionResolver
DefaultHandlerExceptionResolver
上面几个Bean实例。这几个类都是用来做什么的呢?
前两个是HandlerMapping接口的实现类,用来处理请求映射的。其中第一个是处理@RequestMapping注解的。第二个会将controller类的名字映射为请求url。
中间三个是用来处理请求的。具体点说就是确定调用哪个controller的哪个方法来处理当前请求。第一个处理@Controller注解的处理器,支持自定义方法参数和返回值(很酷)。第二个是处理继承HttpRequestHandler的处理器。第三个处理继承自Controller接口的处理器。
后面三个是用来处理异常的解析器。
主要说明里面的两个,RequestMappingHandlerMapping和RequestMappingHandlerAdapter。
第一个是HandlerMapping的实现类,它会处理@RequestMapping 注解,并将其注册到请求映射表中。(下片文章我们会详细介绍的)
第二个是HandlerAdapter的实现类,它是处理请求的适配器,说白了,就是确定调用哪个类的哪个方法,并且构造方法参数,返回值。
- Spring MVC 学习 —— <mvc:annotation-driven/>
- Spring mvc:annotation-driven
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring MVC 解读——<mvc:annotation-driven/>
- Spring参考手册 mvc:annotation-driven
- 【Spring MVC】<mvc:annotation-driven/>详解
- Spring MVC 中关于 mvc:annotation-driven
- spring mvc 之mvc:annotation-driven
- source insight 4乱码的问题及与keil混编的问题
- Top k Largest Numbers II
- break和continue在循环中的区别
- 1035神奇的数字9
- golang基础-互斥锁、读写锁
- Spring MVC 学习 —— <mvc:annotation-driven/>
- Program Size: Code=7044 RO-data=268 RW-data=112 ZI-data=8736解析
- 接口测试工具postman插件安装方法
- 读《你的时间80%都用错了》有感
- 新闻报道文体总结
- python
- appium学习笔记之Androidui自动化测试框架环境和工具集appium+python+sdk+node.js+jdk+pip+robotframework-appiumlibrary等
- android studio 运行出现“The activity must be exported or contain an intent-filter”
- Java tcp练习 返回字母大写