Add docs for Groovy Templates

This commit is contained in:
Dave Syer 2014-05-16 15:28:27 +01:00
parent 2cadf4165f
commit bfbb720d0a
3 changed files with 41 additions and 12 deletions

View File

@ -94,10 +94,21 @@ content into your application; rather pick only the properties that you need.
spring.freemarker.exposeSpringMacroHelpers=false
spring.freemarker.prefix=
spring.freemarker.requestContextAttribute=
spring.freemarker.suffix=
spring.freemarker.suffix=.ftl
spring.freemarker.templateEncoding=UTF-8
spring.freemarker.templateLoaderPath=classpath:/templates/
spring.freemarker.viewNames=
spring.freemarker.viewNames= # whitelist of view names that can be resolved
# GROOVY TEMPLATES ({sc-spring-boot-autoconfigure}}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[GroovyTemplateAutoConfiguration])
spring.groovy.template.allowRequestOverride=false
spring.groovy.template.allowSessionOverride=false
spring.groovy.template.cache=true
spring.groovy.template.contentType=text/html
spring.groovy.template.prefix=classpath:/templates/
spring.groovy.template.suffix=.tpl
spring.groovy.template.templateEncoding=UTF-8
spring.groovy.template.viewNames= # whitelist of view names that can be resolved
spring.groovy.template.configuration.*= # See Groovy's TemplateConfiguration
# INTERNATIONALIZATION ({sc-spring-boot-autoconfigure}/MessageSourceAutoConfiguration.{sc-ext}[MessageSourceAutoConfiguration])
spring.messages.basename=messages

View File

@ -816,8 +816,16 @@ added.
and `spring.freemarker.suffix`, defaults ``'' and ``.ftl'' respectively). It can be overriden
by providing a bean of the same name.
* If you use Groovy templates (actually if groovy-templates is on your classpath) you
also have a `Groovy TemplateViewResolver` with id
``groovyTemplateViewResolver''. It looks for resources in a loader path by
surrounding the view name with a prefix and suffix (externalized to `spring.groovy.template.prefix`
and `spring.groovy.template.suffix`, defaults ``classpath:/templates/'' and ``.tpl'' respectively). It can be overriden
by providing a bean of the same name.
Check out {sc-spring-boot-autoconfigure}/web/WebMvcAutoConfiguration.{sc-ext}[`WebMvcAutoConfiguration`],
{sc-spring-boot-autoconfigure}/thymeleaf/ThymeleafAutoConfiguration.{sc-ext}[`ThymeleafAutoConfiguration`], and
{sc-spring-boot-autoconfigure}/thymeleaf/ThymeleafAutoConfiguration.{sc-ext}[`ThymeleafAutoConfiguration`],
{sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}['GroovyTemplateAutoConfiguration'] and
{sc-spring-boot-autoconfigure}/freemarker/FreeMarkerAutoConfiguration.{sc-ext}['FreeMarkerAutoConfiguration']
@ -1381,7 +1389,6 @@ If you are using Thymeleaf, then set `spring.thymeleaf.cache` to `false`. See
for other Thymeleaf customization options.
[[howto-reload-freemarker-content]]
=== Reload FreeMarker templates without restarting the container
If you are using FreeMarker, then set `spring.freemarker.cache` to `false`. See
@ -1389,6 +1396,12 @@ If you are using FreeMarker, then set `spring.freemarker.cache` to `false`. See
for other FreeMarker customization options.
[[howto-reload-groovy-template-content]]
=== Reload Groovy templates without restarting the container
If you are using Groovy templates, then set `spring.groovy.template.cache` to `false`. See
{sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[`GroovyTemplateAutoConfiguration`]
for other Groovy customization options.
[[howto-reload-java-classes-without-restarting]]
=== Reload Java classes without restarting the container

View File

@ -905,15 +905,20 @@ and it will be silently ignored by most build tools if you generate a jar.
[[boot-features-spring-mvc-template-engines]]
==== Template engines
As well as REST web services, you can also use Spring MVC to serve dynamic HTML content.
Spring MVC supports a variety of templating technologies including: Velocity, FreeMarker,
and JSPs. Many other templating engines also ship their own Spring MVC integrations.
Spring Boot includes auto-configuration support for the Thymeleaf and FreeMarker
templating engines. Thymeleaf is an XML/XHTML/HTML5 template engine that can work both in
web and non-web environments. If allows you to create natural templates that can be
correctly displayed by browsers and therefore work also as static prototypes. Both
FreeMarker and Thymeleaf templates will be picked up automatically from
As well as REST web services, you can also use Spring MVC to serve
dynamic HTML content. Spring MVC supports a variety of templating
technologies including: Velocity, FreeMarker and JSPs. Many
other templating engines also ship their own Spring MVC integrations.
Spring Boot includes auto-configuration support for the Thymeleaf,
[FreeMarker](http://freemarker.org/docs/) and
[Groovy](http://beta.groovy-lang.org/docs/groovy-2.3.0/html/documentation/markup-template-engine.html)
templating engines. Thymeleaf is an XML/XHTML/HTML5 template engine
that can work both in web and non-web environments. If allows you to
create natural templates that can be correctly displayed by browsers
and therefore work also as static prototypes. Your FreeMarker, Groovy
and Thymeleaf templates will be picked up automatically from
`src/main/resources/templates`.