Two cases:
1, if the use of the Thymeleaf template engine, HTML files can be placed in the template folder, if not must not be put in, otherwise cannot find, because HTML is static page, so put this type of file in the static folder.
Join in Pom.xml
<parent> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-start er-parent</artifactid> <version>1.5.2.RELEASE</version> </parent> <dependencies> ; <dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring- boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.myb Atis.spring.boot</groupid> <artifactId>mybatis-spring-boot</artifactId> <versio n>1.2.0</version> </dependency> <dependency> <groupid>mysql</groupi d> <artifactId>mysql-connector-java</artifactId> </dependency> <dependenc Y> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-starter- Data-jpa</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</g roupid> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> < ;/dependencies>
In resources\templates\hello.html
<! DOCTYPE html>
Add to Controller
@RequestMapping ("/hello") public String hellohtml (hashmap<string,object> map) { map.put ("Hello", " Hello "); return "/hello"; }
Start, and then enter Localhost:8080/hello
Will jump to the page
Note: You must join the ThymeleAF package, or you will not find
2. If no template engine is used, the HTML file will be placed in the static folder because it belongs to a statically file.
Springboot Unable to display HTML file cannot find HTML file if HTML file is displayed