I cannot register my argumentResolvers or viewControllers while using WebMvcConfigurationSupport

227 Views Asked by At

When i have my JavaConfig class extends WebMvcConfigurerAdapter like this:

@EnableWebMvc
@EnableSpringDataWebSupport
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(new CustomPageableArgumentResolver());
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("login");
    }
}

my custom Resolver and viewControllers are registered and added when the application deployed.

But when i want to change the super class to WebMvcConfigurationSupport, which also has those methods (add*) and of course more to offer, the Resolver and ViewControllers are not registered. Why?

1

There are 1 best solutions below

0
On BEST ANSWER

I have just found the answer. While using the WebMvcConfigurationSupport, we need to remove the annotation @EnableWebMvc