springboot之默认静态首页设置
2018-02-01 09:19
411 查看
package com.onepro.custom.utils.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.WebMvcConfigurerAdapter; @Configuration public class DefaultView extends WebMvcConfigurerAdapter { public static String LOGIN_USER = "loginUser"; @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("forward:/index.html"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); super.addViewControllers(registry); } }
注 : 静态页面放在 src/main/resources/static 里面
相关文章推荐
- asp.net mvc 默认首页设置静态文件
- SpringBoot入门七,添加默认静态首页
- MVC4.0 如何设置默认静态首页index.shtml
- SpringBoot学习——静态文件存放位置设置
- struts2 设置默认首页不带路径的形式
- Apache中设置默认首页
- Springboot 设置默认首页
- Eclipse自定义类注释模板设置--伪静态首页的拦截☞动态jsp跳转
- 火狐设置首页,当添加新的tab的时候,默认布局格式
- Spring Boot 2.0 设置网站默认首页的实现代码
- Cpanel如何设置index”缺省首页”?.htaccess设置网站默认首页次序?
- Apache虚拟目录和默认首页的设置
- 将默认首页设置成index.do的方法
- Cpanel如何设置index”缺省首页”?.htaccess设置网站默认首页次序?
- C#编译器优化那点事 c# 如果一个对象的值为null,那么它调用扩展方法时为甚么不报错 webAPI 控制器(Controller)太多怎么办? .NET MVC项目设置包含Areas中的页面为默认启动页 (五)Net Core使用静态文件 学习ASP.NET Core Razor 编程系列八——并发处理
- Drupal设置首页默认内容
- asp.net中web.config设置默认首页
- django项目培训站-15-配置首页和登陆页-静态目录设置
- JAVA web设置默认首页
- Apache中如何设置默认首页具体该怎么操作