1.项目配置
application.properties

1 #thymelea模板配置 2 spring.thymeleaf.suffix=.html 3 spring.thymeleaf.mode=HTML5 4 spring.thymeleaf.encoding=UTF-8 5 spring.thymeleaf.servlet.content-type=text/html
pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
PageController.java
@Controller public class PageController{ @RequestMapping("/index") public String index(){ return "indexs"; } }
2.项目结构
然后如果出现404或者505的话
有可能是maven引入的包有问题导致的
IDEA解决方案
右键项目 -》 找到Maven -》 选择Reimport即可,然后重启
eclipse构建的时候让maven重新下载所需jar包才可以。