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. Rsync数据同步服务

    Rsync数据同步服务 Rsync软件适用与unix/linux/windows等多种操作系统平台 Rsync是一款开源的,快速的,多功能的,可实现全量及增量的本地或远程数据同步备份的优秀工具,可以实 ...

  2. JavaScript中的获取元素的方法

    通过id获取元素 document.getElementById(id名字) 通过标签获取元素 document/元素.getElementsByTagName(标签名) 通过css选择器获取元素 d ...

  3. 程序员必会算法-KMP算法

    KMP算法是一种优秀的字符串匹配算法,字符串匹配的常规算法是一步一步进行移位和比较操作,直至找到完全相匹配的字符串. 下面通过一个例子,为大家仔细说明KMP算法的使用和思路: 问题: 在字符串“DEA ...

  4. Python深入理解yield

    yield的英文单词意思是生产,刚接触Python的时候感到非常困惑,一直没弄明白yield的用法. 只是粗略的知道yield可以用来为一个函数返回值塞数据,比如下面的例子: def addlist( ...

  5. [Oracle][RMAN] Use RMAN to Migrate database from CentOS_5-11201-SingleDB to OracleLinux_5-11204-SingleDB

    リンク:How to Move/Restore DB to New Host and File System using RMAN (Doc ID 1338193.1)https://docs.ora ...

  6. Tasklist使用详解

    用jstat查看jvm内存的使用的情况时,因为是windows机器,不能使用top命令方便的查出来,进程好在网上搜了一下看到了在windows原来使用的是tasklist 特意将tasklist的用法 ...

  7. angular 定时函数

    注入$interval,$timeout   服务 2.定义函数 var aa = $interval(function(){ $timout(function(){ ..... }) },,定时时间 ...

  8. python笔记18-高阶函数

    高阶函数: 如果一个函数的入参是一个函数名的话,那这个函数就是一个高阶函数 函数即变量 # def hello(name):# print(name)# new_hello = hello#hello ...

  9. Linux下挂载iso文件和配置yum本地源

    Linux的版本: [root@pbn ~]# head -n 1 /etc/issueRed Hat Enterprise Linux Server release 6.1 (Santiago) 1 ...

  10. easyui datagrid 后台分页,前端如何处理

    module.exports = { queryMethod(){ let params = checkQueryParams.call(this); if (!params) { return; } ...