WebMvcConfigurerAdapter常用的方法

WebMvcConfigurerAdapter常用的方法

1、addInterceptors:拦截器

2、addCorsMappings:跨域

3、addViewControllers:跳转指定页面

4、resourceViewResolver:视图解析器

5、configureMessageConverters:信息转换器

6、addResourceHandlers:静态资源

7、configureContentNegotiation:父类中已经定义好看可以为json输出

WebMvcConfigurerAdapter常用的方法

WebMvcConfigurerAdapter使用方式

1、过时方式:继承WebMvcConfigurerAdapter

2、现用方式

1)实现WebMvcConfigurer

2)现用方式:继承WebMvcConfigurationSupport

 

WebMvcConfigurerAdapter是什么

Spring内部的一种配置方式

采用JavaBean的形式来代替传统的xml配置文件形式进行针对框架个性化定制