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. poj1721

    题解: 直接暴力循环节 然后再做几次 代码: #include<cstdio> #include<cstring> #include<algorithm> #inc ...

  2. 简单的新手加法运算(基于Struts2)

    软件151  王帅 在搭好框架的前提下,首先编写action.java文件: import com.opensymphony.xwork2.ActionSupport; public class Us ...

  3. js 两数的最大公约数

    function gcd(a,b){ if (b == 0){ return a; } var r = parseInt(a % b) ; return gcd(b, r);}gcd(12,5);

  4. SQL-51 查找字符串'10,A,B' 中逗号','出现的次数cnt。

    题目描述 查找字符串'10,A,B' 中逗号','出现的次数cnt. SQL: select length('10,A,B')-length(replace('10,A,B',',','')) len ...

  5. 字符串及其操作,字符的Unicode编码

    plainText=input('message:') for c in plainText: print(chr(ord(c)-3),end='') plainText=input('message ...

  6. 使用mybatis-generator工具自动生成mybatis代码

    使用mybatis-generator工具自动生成mybatis代码 步骤如下: 1.引入maven  依赖,在项目pom.xml文件中添加 <plugin> <groupId> ...

  7. vim 匹配查找指定位置的数字,并将数字做运算后赋值

    举例,以下文本中有个DSC开头的以数字命名的jpg文件,我想修改文件名为在原来的基础上加上32,比如第一行中的字符改为:DSC00099.JPG 在vim中输入: :%s/DSC[]\+\(\d\+\ ...

  8. 【译】REM vs EM - 世纪之争

    原文链接:https://zellwk.com/blog/rem-vs-em/ 在网络上排版的最佳做法之一是使用像rem和em这样的相对单位. 问题是,你应该使用哪个? 在rem支持者和em支持者之间 ...

  9. Linux:Gentoo系统的安装笔记(三)

    这期笔记将是gentoo安装的最后一期了,虽然已经配置内核了,但是也要完成剩下的安装步骤,这离安装完成已经不远了,继续加油!!! 如果中断了安装,请看第二期的笔记进行恢复安装,但请重新编译一次内核,否 ...

  10. 18-11-05ie 热键的使用

    IE浏览器快捷键大全 更新:2013-04-01 17:05 | 标签:快捷键 一般快捷键F11打开/关闭全屏模式 TAB循环的选择地址栏,刷新键和当前标签页 CTRL+F在当前标签页查询字或短语 C ...