@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 );
}
}
改成这样即可。
资源路径