SpringBoot(二)thymeleaf模板的引入

Posted on 2018-06-06 16:38  七月妖妖无  阅读(1103)  评论(0编辑  收藏  举报

接着上一次的配置

1.在pom文件中添加thymeleaf模板的引入,

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

位置如图:

2.在templates包下新建hello.html文件

3.在HelloController中添加,如图

 

启动项目后,访问:http://localhost:8080/zm/hello

 

 总结:只是简单的配置,没有深入,再下一节深入了解一下,thhymeleaf是可以替代jsp的。