@EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
来源:互联网 发布:我爱淘宝网 编辑:程序博客网 时间:2024/05/29 00:31
解析@EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
在spring-boot+spring mvc 的项目中,有些时候我们需要自己配置一些项目的设置,就会涉及到这三个,那么,他们之间有什么关系呢?首先,@EnableWebMvc=WebMvcConfigurationSupport,使用了@EnableWebMvc注解等于扩展了WebMvcConfigurationSupport但是没有重写任何方法,所以有以下几种使用方式:
- @EnableWebMvc+extends WebMvcConfigurationAdapter,在扩展的类中重写父类的方法即可,这种方式会屏蔽springboot的@EnableAutoConfiguration中的设置
- extends WebMvcConfigurationSupport,在扩展的类中重写父类的方法即可,这种方式会屏蔽springboot的@EnableAutoConfiguration中的设置
- extends WebMvcConfigurationAdapter,在扩展的类中重写父类的方法即可,这种方式依旧使用springboot的@EnableAutoConfiguration中的设置
具体哪种方法适合,看个人对于项目的需求和要把控的程度,在WebMvcConfigurationSupport(@EnableWebMvc)和@EnableAutoConfiguration这两种方式都有一些默认的设定,而WebMvcConfigurationAdapter则是一个abstract class。
具体如何类内如何进行个性化的设置,可以参考以下文章:
Spring Boot:定制HTTP消息转换器
EnableWebMvc官方文档
1 0
- @EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
- 解析@EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
- WebMvcConfigurationSupport
- @EnableWebMVC
- java 方式配置spring mvc 继承WebMvcConfigurerAdapter和继承WebMvcConfigurationSupport
- Spring @EnableWebMvc
- xml零配置之WebMvcConfigurationSupport
- @EnableWebMvc 与 @EnableAutoConfiguration 的关系
- . 和 ->
- || 和&&
- .和::
- “?”和“!”
- #和##
- && 和 ||
- 、和
- #和##
- .//和..//
- 和
- 频繁模式挖掘 Apriori
- 电子商务秒杀所带来的问题
- 修改PHP 上传文件大小限制
- jQuery 学习笔记(二 )
- Qt 工程
- @EnableWebMvc 、WebMvcConfigurationSupport和WebMvcConfigurationAdapter
- 破解某拼图验证码
- 第十四周【项目一-(3)二叉排序树】
- VisualStudio20008快捷键大全
- rpm升级JDK
- HDU1517A Multiplication Game
- android窗口显示模式
- Java重载与覆盖的区别
- android AOSP 的test-key签名