package com.nbclass.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 默认首页
 * @author Leon
 * @datetime 2019年4月11日 下午5:14:24
 */
@Configuration
public class DefaultViewConfig implements WebMvcConfigurer {

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/").setViewName("forward:/index.html");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);	// 设置为最高级，哪怕其他controller里有映射(也就是 /)那么根据优先级，也会先加载这个配置
		WebMvcConfigurer.super.addViewControllers(registry);
	}
	
}
