Chapter 16. Additional Quarkus Features
This chapter contains features of Quarkus that don’t fit into any other chapter. That, of course, doesn’t make them any less useful! In this chapter, you’ll learn about the following topics:
Quarkus’s templating solution, Qute
Application data caching
16.1 Creating Templates with the Qute Template Engine
You want to create templates and render them with specific data.
Use the Qute template engine.
Qute is a templating engine designed specifically to meet the Quarkus needs of minimizing the usage of reflection and supporting the imperative and reactive style of coding.
Qute can be used as a standalone library (generating reports to disk or generating e-mail body messages) or together with JAX-RS to deliver HTML content.
To start using Qute with JAX-RS, add the
./mvnw quarkus:add-extension -Dextensions
By default, templates are stored at the src/main/resources/templates directory and its subdirectories.
The following might be a simple template as a plain-text file:
The template is a simple sentence parametrized with the
To render the template with concrete data, you just need to inject the
io.quarkus.qute.Template instance and provide the template parameters: