Since Spring 5.0, WebMvcConfigurer has Java 8 default methods. That means, for MVC configuration, we can implement this interface directly without extending WebMvcConfigurerAdapter (deprecated in 5.0).
Example
Implementing WebMvcConfigurer
@EnableWebMvc
@Configuration
@ComponentScan
public class MyWebConfig implements WebMvcConfigurer {
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
registry.jsp("/WEB-INF/views/", ".jsp");
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
//this will map uri to jsp view directly without a controller
registry.addViewController("/hi")
.setViewName("hello");
}
}