java为什么使用WebMVCAutoConfiguration适配器类
package com.ge.hc.gsit.sbom.configuration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@Configuration
@EnableAutoConfiguration
@EnableWebMvc
@ComponentScan(basePackages = {"com.abc.xy.gsit.sbom.controller","com.abc.xy.gsit.sbom.exception"})
public class MvcConfig extends WebMvcAutoConfigurationAdapter{
}
嗨
我想知道WebMvcAutoConfigurationAdapter类是如何工作的
如果有任何文件,请让我知道,这将是有益的
提前谢谢
# 1 楼答案
在
WebMvcAutoConfigurationAdapter
中的评论指出:WebMvcAutoConfigurationAdapter
类扩展了WebMvcConfigurerAdapter
并提供了WebMvcConfigurer
接口方法的默认实现,这些接口方法是回调,用于定制通过@EnableWebMvc
启用的基于Java的Spring MVC配置所以,如果你想改变一些行为,你应该扩展
WebMvcConfigurerAdapter
关于
EnableAutoConfiguration
和Spring Boot的更多详细信息:Understanding Spring Boot