@Configuration
public class DefaultView extends WebMvcConfigurerationSupport {
@Override
public void addViewControllers( ViewControllerRegistry registry ) {
registry.addViewController( "/" ).setViewName( "tryRedis" );
registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
     super.addViewController(registry);
}
}

这种配置会导致springboot的自动默认配置失效
@Configuration
public class DefaultView implements WebMvcConfigurer {
    @Override
    public void addViewControllers( ViewControllerRegistry registry ) {
        registry.addViewController( "/" ).setViewName( "tryRedis" );
        registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
    }
}

改成这样即可。

资源路径

posted on 2019-01-10 14:24  不爱吃蘑菇的大蘑菇  阅读(259)  评论(0编辑  收藏  举报