码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot全面接管SpringMVC

时间:2018-11-04 14:05:01      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:let   全面   ase   ann   springmvc   targe   figure   map   except   

Spring Boot官方文档描述

If you want to keep Spring Boot MVC features and you want to add additional MVC configuration (interceptors, formatters, view controllers, and other features), you can add your own @Configuration class of type WebMvcConfigurer but without @EnableWebMvc. If you wish to provide custom instances of RequestMappingHandlerMappingRequestMappingHandlerAdapter, or ExceptionHandlerExceptionResolver, you can declare a WebMvcRegistrationsAdapter instance to provide such components.

If you want to take complete control of Spring MVC, you can add your own @Configuration annotated with @EnableWebMvc.

 


 

 原来的SpringMVC配置方式:

  • <mvc:view-controller path="/hello" view-name="success"/>
        <mvc:interceptors>
            <mvc:interceptor>
                <mvc:mapping path="/hello"/>
                <bean></bean>
            </mvc:interceptor>
        </mvc:interceptors>

     

现在的SpringBoot方式:

  add your own @Configuration class of type WebMvcConfigurer but without @EnableWebMvc

技术分享图片

 

 技术分享图片

 

SpringBoot全面接管SpringMVC

标签:let   全面   ase   ann   springmvc   targe   figure   map   except   

原文地址:https://www.cnblogs.com/guchunchao/p/9903522.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!