关于 Springboot 访问 html 404

Springboot 项目中,当我们在 resources 目录下创建了一个 index.html 的页面

image.png

出现了 404 错误


需要注意两处:

pom.xml 文件中导入模板依赖
   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-thymeleaf</artifactId>
   </dependency>




index.html 放入到resources/templates 或者 resources/static 目录下

访问 localhost:8080 即可

image.png

评论

暂无评论