Is it possible to extend WebMvcConfigurationSupport and use WebMvcAutoConfiguration?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
In Spring Boot, extending WebMvcConfigurationSupport is usually a signal that you want to take over MVC configuration yourself. That matters because Boot's MVC auto-configuration is designed to back off when you provide your own full MVC configuration. So the short answer is: not in the way most people hope.
Why Boot backs off
WebMvcAutoConfiguration exists to configure Spring MVC automatically with sensible defaults such as message converters, static resource handling, formatters, and argument resolvers. When you extend WebMvcConfigurationSupport, you are effectively providing a custom MVC setup, so Spring Boot assumes you want control and disables large parts of its automatic configuration.
That is why these two approaches do not compose naturally:
- Boot auto-configures MVC for you
- '
WebMvcConfigurationSupportlets you configure MVC yourself'
Trying to do both usually leads to missing defaults and confusing behavior.
Prefer WebMvcConfigurer for customization
If your real goal is "keep Boot defaults, but add a few customizations," implement WebMvcConfigurer instead of extending WebMvcConfigurationSupport.
This approach keeps WebMvcAutoConfiguration active while still allowing you to customize the framework.
What happens if you extend WebMvcConfigurationSupport
If you do this:
you are stepping outside the usual Boot customization path. You may need to re-declare behavior that Boot would otherwise supply automatically, such as resource handlers or message converter defaults.
That is sometimes justified in advanced scenarios, but it should be an intentional decision, not a casual customization step.
For example, static resource handling may need to be reintroduced explicitly:
That kind of extra work is exactly why WebMvcConfigurer is usually the better extension point for ordinary Boot applications.
When full control is actually appropriate
There are cases where extending WebMvcConfigurationSupport makes sense:
- you are building a framework layer on top of Spring MVC
- you need deep control over handler mappings or adapters
- Boot's defaults actively conflict with the architecture you want
In those situations, it is better to accept that you are taking over MVC configuration. Do not expect Boot auto-configuration to keep filling in the gaps.
A practical mental model
Think of the choices like this:
- '
WebMvcConfigurer: incremental customization on top of Boot defaults' - '
WebMvcConfigurationSupport: full ownership of MVC setup'
That distinction is more useful than memorizing implementation details. It helps you choose the right abstraction before the application becomes hard to reason about.
If you only need to add interceptors, CORS rules, view controllers, or formatters, WebMvcConfigurer is almost always the right answer.
Common Pitfalls
The biggest pitfall is extending WebMvcConfigurationSupport to make one small change and then being surprised when static resources, JSON handling, or other defaults behave differently. Boot did not "randomly break." You told it to step back.
Another issue is mixing advice from plain Spring MVC examples with Spring Boot applications. Many old tutorials assume you are wiring MVC manually. In Boot, the extension point is usually different.
It is also easy to overcorrect with @EnableWebMvc. That annotation similarly switches you into a more manual MVC mode and can disable useful Boot behavior.
Finally, if you truly need full control, document that decision clearly. Otherwise the next developer may spend hours trying to understand why ordinary Boot MVC conventions are not applying.
Summary
- Extending
WebMvcConfigurationSupportgenerally disables the normal Spring Boot MVC auto-configuration path. - Use
WebMvcConfigurerwhen you want to keep Boot defaults and add small customizations. - Choose
WebMvcConfigurationSupportonly when you intentionally want full MVC control. - Do not expect Boot to keep supplying all defaults after you take over MVC configuration.
- Treat the choice as an architectural one, not just a syntax preference.
Related reading
- Is it possible to have replicated JVMs so that i can simply flip over from primary jvm to secondary in case primary jvm goes down
- Is it possible to mark springboot tests so they run only when certain profile is active
- Is it possible to read from a InputStream with a timeout?
- Is it possible to register Controller specific ObjectMapper in SpringBoot
- Is it possible to rename a maven jar-with-dependencies?
- Is it possible to set a different specification per cache using caffeine in spring boot?
- Is it possible to set private property via reflection?
- Is it possible to use Java 8 for Android development?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.