In Spring MVC version 5.0.0.RC1 the WebMvcConfigurerAdapter is depricated, so what is the alternative.

I have upgraded my project from spring 4.x to 5.0.0.RC1 and the bean configuration file i have extended to WebMvcConfigurerAdapter. But now after upgrade to latest spring version the class WebMvcConfigurerAdapter is showing as deprecated. I am trying to find out the alternative of this class provided in spring 5.0.0.RC1.



You can use below way to make things work:

package com.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

 * @author Deb 19 May 2017
@ComponentScan(basePackages = { "com.test.controller" })
public class KodetalkResolver implements WebMvcConfigurer {
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		// Your code

	public ViewResolver liteDeviceAwareViewResolver() {

The alternative would be WebMvcConfigurationSupport class. You can use this.

Answer is