zoukankan      html  css  js  c++  java
  • Spring EnableWebMvc vs WebMvcConfigurationSupport

    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注解
  • 相关阅读:
    day13—— luffy项目 User表的配置
    day13 —— luffy项目 数据库配置
    day13- luffy项目 后端搭建
    Vue环境搭建
    Python创建虚拟环境
    pip换源
    day12--DRF 进阶7 JWT补充、基于权限的角色控制、django缓存
    C语言输出格式总结-printf()
    PAT 甲级 1108 Finding Average (20分)
    DAY30
  • 原文地址:https://www.cnblogs.com/tao_/p/9265283.html
Copyright © 2011-2022 走看看