Springboot2.0中WebMvcConfigurerAdapter过时问题处理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qh870754310/article/details/85760032

在Springboot中配置WebMvcConfigurerAdapter的时候发现这个类过时了。所以看了下源码,发现官方在spring5弃用了

WebMvcConfigurerAdapter,因为springboot2.0使用的spring5,所以会出现过时。
但是这个问题也很好解决,我们只需要实现 WebMvcConfigurer接口就可以了。

/**
 * @Author: qh
 * @Date: 2019/1/3 17:37
 * @Description:
 */
@Configuration
public class Cfg_View implements WebMvcConfigurer {

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

猜你喜欢

转载自blog.csdn.net/qh870754310/article/details/85760032
今日推荐