2017-05-31 71 views
0
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类

我想知道如何WebMvcAutoConfigurationAdapter类工作。

如果有任何文件存在请让我知道,这将是有益的。

在此先感谢。

回答

0

WebMvcAutoConfigurationAdapter评论指出:

//定义为一个嵌套的配置,以确保WebMvcConfigurerAdapter不被读取时不

//在classpath

WebMvcAutoConfigurationAdapter类扩展WebMvcConfigurerAdapter,并提供WebMvcConfigurer接口方法的默认实现,这些方法是回调函数,用于自定义Spring MVC e的基于Java的配置通过@EnableWebMvc

所以,如果你想改变一些行为,你应该扩展WebMvcConfigurerAdapter

有关EnableAutoConfiguration和Spring Boot的更多详细信息:Understanding Spring Boot

相关问题