Template Engines for Spring: FreeMarker | Java Server Pages | Thymeleaf | Jade4j

发布时间 2023-12-15 18:48:37作者: 任国强

Besides the template engines described so far, there are quite a few more available which may be used.

Let’s review some of them briefly.

Velocity is an older template engine, which is very complex but has the disadvantage that Spring has deprecated its use since version 4.3 and removed completely in Spring 5.0.1.

JMustache is a template engine which can be easily integrated into a Spring Boot application by using the spring-boot-starter-mustache dependency.

Pebble contains support for Spring and Spring Boot within its libraries.

Other templating libraries such as Handlebars or React, running on top of a JSR-223 script engine such as Nashorncan also be used.

 

* [SpringBoot2.x系列教程(二十六)Springboot集成freemarker-腾讯云开发者社区-腾讯云](https://cloud.tencent.com/developer/article/1582376)
* [Spring Boot 整合 Freemarker 模板引擎 - spring 中文网](https://springdoc.cn/springboot-freemarker/)
* [Template Engines for Spring | Baeldung](https://www.baeldung.com/spring-template-engines)
* [Beetl 官网](http://ibeetl.com/)

Beetl远超过主流java模板引擎性能(引擎性能5-6倍与freemaker,2倍于JSP),宏观上通过了优化的渲染引擎,IO的二进制输出,字节码属性访问增强,微观上通过一维数组保存上下文Context,静态文本合并处理,重复使用字节数组来防止java频繁的创建和销毁数组,还使用模板缓存,运行时优化等方法。