在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");
}
}