Using Thymeleaf to render a Publisher<T> stream
Other than FreeMarker, Spring 5 has a strong built-in support for Thymeleaf template compilation, with the objective of rendering Reactive Stream data directly.
Getting started
Open the Maven project ch08
and add the following view configuration for Thymeleaf
integration.
How to do it...
To use Thymeleaf as the templating procedure for rendering reactive contents, follow these steps:
- Before this recipe starts, be sure to have the Spring Reactive dependency included in
pom.xml
since we are building now a reactive web application. - If the rendition requires the use of non-blocking
Mono<T>
andFlux<T>
operations, then Thymeleaf is the appropriate templating library to use, because FreeMarker cannot directly recognize non-blocking operations. To integrateThymeleaf
for Spring 5, add the following Maven dependencies:
<dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring5</artifactId...