SpringMVC之mvc:annotation-driven
来源:互联网 发布:网络广告发布软件 编辑:程序博客网 时间:2024/05/16 17:54
一、RequestMappingHandlerMapping RequestMappingHandlerAdapter与mvc:annotation-driven的区别
在配置中经常出现RequestMappingHandlerMapping,这个是对注解@RequestMapping的处理。其目的是帮助DispatcherServlet找到对应处理的Controller来处理响应的请求。
mvc:annotaion-driven(处理类:org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser)包含的注解处理更广,除了@RequestMapping的处理,还包括
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
异常处理:
org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver
org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver
mvc:annotation-driven的作用:主要是用来帮助我们处理请求映射,决定是哪个controller的哪个方法来处理当前请求,以及异常处理。
二、annotaion-driven与RequestMappingHandlerMapping 混合使用
由于annotaion-driven中存在RequestMappingHandlerMapping 如果想要自定义的RequestMappingHandlerMappingXX生效需要覆盖掉annotaion-driven中的RequestMappingHandlerMapping
如何实现呢?
class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { //需要覆盖public static final String HANDLER_MAPPING_BEAN_NAME = RequestMappingHandlerMapping.class.getName();public static final String HANDLER_ADAPTER_BEAN_NAME = RequestMappingHandlerAdapter.class.getName();
- SpringMVC之mvc:annotation-driven
- SpringMVC-->mvc:annotation-driven
- SpringMVC 解读之<mvc:annotation-driven/>标签
- SpringMVC 解读之<mvc:annotation-driven/>标签
- SpringMVC-07 mvc:annotation-driven
- 【springmvc解读】<mvc:annotation-driven/>
- SpringMVC源码研究之注解<mvc:annotation-driven />
- SpringMVC—<mvc:annotation-driven/>标签
- SpringMVC 解读——<mvc:annotation-driven/>
- ajax请求springmvc与mvc:annotation-driven
- SpringMVC 解读——<mvc:annotation-driven/>
- SpringMVC-<mvc:annotation-driven>的作用
- springmvc显示json数据 :<mvc:annotation-driven>
- springmvc标签<mvc:annotation-driven/>(十二)
- SpringMVC 解读——<mvc:annotation-driven/>
- spring mvc 之mvc:annotation-driven
- Spring MVC之<mvc:annotation-driven/>
- SpringMVC——静态资源访问之<mvc:annotation-driven/>与<mvc:default-servlet-handler/>
- 解决java请求跨域
- idea Debug 非常卡
- Java7 Fork-Join 框架:任务切分,并行处理
- PHP进阶之数据库设计/ 第二节:选择合适的表引擎(笔记)
- 使用IBM Data Studio 管理DB2
- SpringMVC之mvc:annotation-driven
- 神经网络不胜语__M-P模型似可寻
- java enum(枚举)使用详解 + 总结
- 20170531Windows08_CopyFile
- CODEVS 1020 孪生蜘蛛
- 利用KMeans算法对图片进行分割
- BM字符串匹配算法笔记
- Android根据图片Uri获取图片绝对路径
- Java职业生涯规划