自定义欢迎页
SpringBoot项目在启动后,首先会去静态资源路径下查找index.html作为首页文件,若查找不到,则会去查找动态的index文件作为首页文件。例如,如果想使用静态的index.html页面作为项目首页,那么只需在resources/static目录下创建index.html文件即可。若想使用动态页面作为项目首页,则需在resources/templates目录下创建index.html (使用Thymeleaf模板)或者index.ftl (使用FreeMarker模板),然后在Controller中返回逻辑视图名,代码如下:
@RequestMapping ("/index")
public String hel1o() {
return "index";
}
最后启动项目,输入“http://localhost:8080/" 就可以看到项目首页的内容了。