无法加载SpringBoot模板html

时间:2018-08-09 05:46:52

标签: html spring-boot templates

我在templates下放置了两个html文件:index.htmltest.htmlindex.html可以正确显示,而我不会通过

显示test.html
<a href="test.html">Contact Me</a>

然后出现404

我在项目中包含了thymeleaf

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

谢谢。

1 个答案:

答案 0 :(得分:0)

最后,我将test.html移到static,并将index.html保留在templates下。现在我可以在test.html中加载index.html。首先,我应该将所有静态资源放在static下。