springmvc拦截器中handler转化成HandlerMethod

在spring-mvc.xml中添加如下配置

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" p:ignoreDefaultModelOnRedirect="true">

    <property name="messageConverters">

            <ref bean="mappingJacksonHttpMessageConverter" />

<mvc:interceptors>

    <mvc:interceptor>

        <mvc:mapping path="/**"/>

        <bean class="com.menglong.interceptor.CompanyInterceptor" />

    </mvc:interceptor>

</mvc:interceptors>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,948评论 18 139
  • Spring Web MVC Spring Web MVC 是包含在 Spring 框架中的 Web 框架,建立于...
    Hsinwong阅读 22,551评论 1 92
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,958评论 6 342
  • 本文是我自己在秋招复习时的读书笔记,整理的知识点,也是为了防止忘记,尊重劳动成果,转载注明出处哦!如果你也喜欢,那...
    波波波先森阅读 12,327评论 6 86
  • 第一卷:摆渡镇 第一章:山上人、山下人(中) 摆渡村为摆渡镇五村之首,村子位于正中央,东南西北连着四大村。正午时分...
    万苏宝宝阅读 582评论 0 0