(Quick Reference)

6 Groovy Template

Version: 8.0.0-M2

6 Groovy Template

6.1 Introduction

The Groovy Markup Template Engine is primarily aimed at generating XML-like markup (XML, XHTML, HTML5, and others), but you can use it to generate any text-based content. The Spring Framework has a built-in integration for using Spring MVC with Groovy Markup.

Spring Boot provides auto-configuration support for Apache FreeMarker. Grace Views Groovy Templates includes spring-boot-starter-groovy-templates which uses the Groovy template engine.

Groovy Templates are written in Groovy, end with the file extension .tpl and reside in the app/views directory.

6.2 Installation

Add the grace-views-groovy-templates dependency to your build.gradle.

implementation "org.graceframework.views:grace-views-groovy-templates:8.0.0-M2"

6.3 Configuration

Groovy Templates configuration can be altered with app/conf/application.yml.

For example:

grails:
    views:
        groovy:
            template:
                enabled: true
spring:
    groovy:
        template:
            ...

There are a number of spring.groovy.template properties that can be set if you want to customize the Groovy template engine.

See the Groovy Templating Properties section of the Spring Boot Appendix.