/**
 * @Author: 臧立昆
 * @Email: 740969606@qq.com
 * @Date: 2020/8/1
 * @Time: 16:28
 */
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;

@Configuration
public class IndexViewConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //设置访问路径为 “/”
        registry.addViewController("/").setViewName("forward:/index.html");
        //设置为最高优先级
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }
}

然后 在resources文件夹下面创建一个static的文件夹 里面放一个叫 index.html 即可