首页 > 编程语言 > 详细

SpringBoot全面接管SpringMVC

时间:2018-11-04 13:19:30      阅读:258      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!