EnableWebMvc vs WebMvcConfigurationSupport

  • spring doc解释

    • WebMvcConfigurationSupport: This is the main class providing the configuration behind the MVC Java config. It is typically imported by adding @EnableWebMvc to an application @Configuration class

    • @EnableWebMvc
      • To customize the imported configuration, implement the interface WebMvcConfigurer and override individual methods
      • If WebMvcConfigurer does not expose some more advanced setting that needs to be configured consider removing the @EnableWebMvc annotation and extending directly from WebMvcConfigurationSupport or DelegatingWebMvcConfiguration
      • // 使用@EnableWebMvc注解会覆盖自定义的WebMvcConfigurationSupport配置
  • 二者的共同点
    • 都是为了配置MVC
  • 二者的区别
    • @EnableWebMvc注解的实现是基于WebMvcConfigurationSupport,详见@EnableWebMvc的doc
    • 三种应用形式只能选其一,如果自定义的WebMvcConfigurationSupport与@EnableWebMvc共同存在,则自定义的WebMvcConfigurationSupport配置会被覆盖
      • 自定义(高级模式): 继承WebMvcConfigurationSupport
      • 自定义(极简模式): @EnableWebMvc注解+实现WebMvcConfigurer接口
      • 默认模式: 使用@EnableWebMvc注解

Spring EnableWebMvc vs WebMvcConfigurationSupport的更多相关文章

  1. Spring boot 梳理 -@SpringBootApplication、@EnableAutoConfiguration与(@EnableWebMVC、WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter)

    @EnableWebMvc=继承DelegatingWebMvcConfiguration=继承WebMvcConfigurationSupport 直接看源码,@EnableWebMvc实际上引入一 ...

  2. 【springboot】之 解析@EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter

    springboot默认格式化日期只需要在application文件中配置 spring.jackson.date-format= yyyy-MM-dd HH:mm:ss spring.jackson ...

  3. 四、Spring Boot Web开发

    四.Web开发 1.简介 使用SpringBoot: 1).创建SpringBoot应用,选中我们需要的模块: 2).SpringBoot已经默认将这些场景配置好了,只需要在配置文件中指定少量配置就可 ...

  4. Spring Boot总结

    一.Spring Boot 入门 1.Spring Boot 简介 简化Spring应用开发的一个框架: 整个Spring技术栈的一个大整合: J2EE开发的一站式解决方案: 2.微服务 2014,m ...

  5. SSM和Spring Boot常用配置比较

    一.Dao层相关 1.Mysql相关: 1.1配置DataSource连接池: (1)SSM配置: <!-- 加密后配置自己写的解析文件 --> <bean class=" ...

  6. Spring Boot笔记一

    Spring Boot 入门 Spring Boot 简介 > 简化Spring应用开发的一个框架:> 整个Spring技术栈的一个大整合:> J2EE开发的一站式解决方案: 微服务 ...

  7. 4.Spring Boot web开发

    1.创建一个web模块 (1).创建SpringBoot应用,选中我们需要的模块: (2).SpringBoot已经默认将这些场景配置好了,只需要在配置文件中指定少量配置就可以运行起来 (3).自己编 ...

  8. spring rest小马哥

    幂等 PUT 初始状态:0 修改状态:1 * N 最终状态:1 DELETE 初始状态:1 修改状态:0 * N 最终状态:0 非幂等 POST 初始状态:1 修改状态:1 + 1 =2 N次修改: ...

  9. Spring Boot-@EnableWebMvc注解

    作用:当配置类中添加了该注解了之后,就表示某个模块的自动配置就都失效了,全部都要自己配置 例如下面这个MVC模块的配置类 /** * @author:抱着鱼睡觉的喵喵 * @date:2020/12/ ...

随机推荐

  1. Factorial(hdu 1124)

    Description The most important part of a GSM network is so called Base Transceiver Station (BTS). Th ...

  2. ubuntu16.04安装anaconda、环境配置

    anaconda默认3.7降级到3.6 conda install python=3.6 anaconda安装后找不到conda命令: 执行测试命令 conda info -e conda: comm ...

  3. 【算法】单源最短路——Dijkstra

    对于固定起点的最短路算法,我们称之为单源最短路算法.单源最短路算法很多,最常见的就是dijkstra算法. dijkstra主要用的是一种贪心的思想,就是说如果i...s...t...j是最短路,那么 ...

  4. 小学生四则运算JAVA

    点我,github地址 组员:黄浩格,何坤 一.项目说明 1题目:实现一个自动生成小学四则运算题目的命令行程序. 2说明: 自然数:0, 1, 2, -. • 真分数:1/2, 1/3, 2/3, 1 ...

  5. Eclipse使用技巧--自动提示

    window->Preferences->java->Editor->Content Assist 一:Auto activation delay 智能提示反应时间(毫秒) 二 ...

  6. react-native 安装的时候遇到的问题

    JAVA  JDK必须要版本8以上(卡了我好大一会,不要忘了环境变量换成8的路径) 这个报错是因为我的版本没升级? 总之解决方法如下 给升级下就好啦~ 然后出现个这么个问题,是因为我用的测试手机是红米 ...

  7. Python常用数据类型

    一 .列表 name = ['zhangshan', 'lishi', 'wangwu']# 列表赋值 name.append('liujun')# 增,默认增加到最后位置 name.insert(1 ...

  8. hive批量删除表

    #!/bin/shhive -e "use csxuy;show tables;"|grep product_tour2 | while read linedoecho -n &q ...

  9. unity3d 数据加/解密

    [/font]using System.Collections; using System.Text; using System.Security.Cryptography; using System ...

  10. nginx申请并配置免费https

    你还在让你的网站裸奔在网络上吗?在这里我们将搭建免费版HTTPS,免费的,免费的,免费的,重要的事情说三遍,申请来源为letsencrypt, 超文本传输协议HTTP协议被用于在Web浏览器和网站服务 ...