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类是如何工作的。
如果有任何文件,请告诉我,这将是有帮助的。
提前谢谢。
发布于 2017-05-31 18:56:37
WebMvcAutoConfigurationAdapter中的注释声明:
//定义为嵌套配置,确保不读取时不读取WebMvcConfigurerAdapter
//在类路径上
WebMvcAutoConfigurationAdapter类扩展了WebMvcConfigurerAdapter,并提供了WebMvcConfigurer接口方法的默认实现,这些方法是为通过@EnableWebMvc启用的Spring MVC定制基于Java的配置的回调。
所以,如果你想改变一些行为,你应该扩展WebMvcConfigurerAdapter。
更多关于EnableAutoConfiguration和Spring Boot的详细信息:Understanding Spring Boot
https://stackoverflow.com/questions/44280287
复制相似问题