webmvcconfigurationsupport继承
时间: 2023-05-10 18:03:23 浏览: 92
WebMvcConfigurationSupport 是 Spring Boot 中一个特别重要的类,主要处理 Web MVC 相关的一些配置。对于该类的继承,主要分两种情况:
1. 直接继承 WebMvcConfigurationSupport
在 Spring Boot 中,可以直接继承 WebMvcConfigurationSupport 类来定制 MVC 相关的配置,并重写其中的一些方法,以定制自己的 MVC 配置。继承该类之后,需要像普通的 Bean 一样声明该 Bean,即通过 @Configuration 声明该配置类,并将其加入到 Spring 容器之中。
2. 子类继承 WebMvcConfigurationSupport
另一种情况是,如果用户已经有一个基础的 MVC 配置类,并且想要进一步定制自己的 MVC 配置,可以通过子类继承 WebMvcConfigurationSupport 类实现。这样做可以在继承基础配置的同时,拓展一些特殊的配置。需要注意的是,子类继承 WebMvcConfigurationSupport 类后,同样需要加上 @Configuration 注解。
总的来说,WebMvcConfigurationSupport 类的继承是非常灵活的,可以根据具体业务场景和需求,进行灵活定制。这样做可以满足不同用户的需求,同时也充分体现出了 Spring Boot 框架的灵活性和扩展性。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)