Spring Boot--默认页面设置

发布时间 2024-01-06 21:55:47作者: DoubleLi

#Spring Boot–默认页面设置

上网找了老长时间, 百度只有几个案例, 挨个试了试都不行, 我的目录结构是 :

| -resources
| - -static
| - - -html ->index.html

只能输入/html对index.html进行访问, 各种尝试后

Spring Boot默认提供静态资源目录位置需置于classpath下, 文件名需符合下面规则:

/static
/public
/resources
/META-INF/resources
灵光一现想到web项目的默认页面是直接放在webcontent下面, 虽然需要在web.xml配置, 虽然Spring Boot 并没有web.xml但试试又不要钱于是
只要将index.html放在上面规则的目录下, 在访问项目的时候会被默认加载