首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我们使用WebMvcAutoConfigurationAdapter类

为什么我们使用WebMvcAutoConfigurationAdapter类
EN

Stack Overflow用户
提问于 2017-05-31 17:03:36
回答 1查看 596关注 0票数 1
代码语言:javascript
复制
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类是如何工作的。

如果有任何文件,请告诉我,这将是有帮助的。

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2017-05-31 18:56:37

WebMvcAutoConfigurationAdapter中的注释声明:

//定义为嵌套配置,确保不读取时不读取WebMvcConfigurerAdapter

//在类路径上

WebMvcAutoConfigurationAdapter类扩展了WebMvcConfigurerAdapter,并提供了WebMvcConfigurer接口方法的默认实现,这些方法是为通过@EnableWebMvc启用的Spring MVC定制基于Java的配置的回调。

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

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44280287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档