springBoot怎么与Thymeleaf模板引擎结合使用-创新互联
这篇文章给大家介绍spring Boot怎么与Thymeleaf模板引擎结合使用,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
Thymeleaf:
- Thymeleaf是一个java类库,他是一个xml/xhtml/html5的模板引擎,可以作为mvc的web应用的view层。
- Thymeleaf还提供了额外的模块与Spring MVC集成,所以我们可以使用Thymeleaf完全替代jsp。
spring Boot
- 通过org.springframework.boot.autoconfigure.thymeleaf包对Thymeleaf进行了自动配置。
- 通过ThymeleafAutoConfiguration类对集成所需要的bean进行自动配置。包括templateResolver,templateEngine,thymeleafViewResolver的配置。
下面我将演示spring boot 日常工作中常用的Thymeleaf用法。
Spring Boot 日常工作中常用Thymeleaf的用法
1:首先,在创建项目的时候选择依赖中选中Thymeleaf,或者在pom中添加依赖
org.springframework.boot spring-boot-starter-thymeleaf
文章标题:springBoot怎么与Thymeleaf模板引擎结合使用-创新互联
网页URL:http://azwzsj.com/article/dijdsi.html