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. riakKV 配置

    安装好riakKV之后, 我们需要将 riak.conf 文件中的 nodename修改为本机的 IP 地址. nodename = xx@xxx.xxx.xx.xx listener.http.in ...

  2. linux TOP参数

    TOP参数 top - 01:06:48 up  1:22,  1 user,  load average: 0.06, 0.60, 0.48Tasks:  29 total,   1 running ...

  3. presto 判断数据量是否大于一个比较小的值的优化

    问题来源于以下场景: 我们需要对一张数据表做导出文件操作,需要判断如果数据量不多的时候,直接导出提供下载,如果数据量超过一定数值,则异步处理导出和下载. 这里就引入一个问题,如果我们直接count一张 ...

  4. ROS机器人导航仿真(kinetic版本)

    准备工作: ubuntu 16.04系统;ROS kinetic版本;ROS包turtlebot,导航包rbx1,模拟器arbotix,可视化rviz 1.安装ubuntu 16.04系统与安装ROS ...

  5. Forth-83 多任务解析

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

  6. npx

    npx 是什么? npm v5.2.0引入的一条命令(npx),引入这个命令的目的是为了提升开发者使用包内提供的命令行工具的体验. 举例:使用create-react-app创建一个react项目. ...

  7. js 回调

    function getTittleLableData(callback) { $.ajax({ type : 'POST', url : ctx + '/feeInf/getDataValue', ...

  8. 并查集(POJ1182)

    链接:http://poj.org/problem?id=1182 定义一种关系R(x,y),x > y 时 R(x,y) = 2:x = y 时 R(x,y)= 1:x < y 时 R( ...

  9. union、union all 、distinct的区别和用途

    1.从用途上讲 它们都具有去重的效果 2.从效率上讲 distinct通常不建议使用,效率较低;union all 和union 而言,union all效率更高;原因是:union 相当于多表查询出 ...

  10. intellij idea 程序包不可见问题

    刚用intellij idea不久,出现了个程序包不可见的问题. 原因:jdk9的问题,用的是jdk9就会出现这个问题. 解决办法:把jsk9换成jdk1.8就能解决.