Springboot 设置默认首页
在common目录下创建一个Java类DefultView,核心代码为
-
public void addViewControllers(ViewControllerRegistry registry)
{
registry.addViewController("/").setViewName("forward:/welcome.html");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.addViewControllers(registry);
}
2 在static目录下创建welcome.html文件用于作为首页进行展示,welcome中的内容根据需要进行编写