Extend TemplateViewResolverProperties for Groovy

Use AbstractTemplateViewResolverProperties as the base class for
GroovyTemplateProperties since the Spring GroovyMarkupViewResolver is
an AbstractTemplateViewResolver.

The auto-configuration for Groovy is now more aligned with the existing
Freemarker and Velocity auto-configuration, with a `resourceLoaderPath`
property being used instead of `prefix`.

Fixes gh-3365
Closes gh-3374
This commit is contained in:
Marten Deinum
2015-07-01 08:19:01 +02:00
committed by Phillip Webb
parent 098392d77a
commit a3e62676af
6 changed files with 27 additions and 44 deletions

View File

@@ -205,8 +205,9 @@ content into your application; rather pick only the properties that you need.
spring.groovy.template.configuration.*= # See GroovyMarkupConfigurer
spring.groovy.template.content-type=text/html
spring.groovy.template.enabled=true # enable MVC view resolution
spring.groovy.template.prefix=classpath:/templates/
spring.groovy.template.suffix=.tpl
spring.groovy.template.prefix=
spring.groovy.template.resource-loader-path=classpath:/templates/
spring.groovy.template.suffix=.tpl
spring.groovy.template.view-names= # whitelist of view names that can be resolved
# VELOCITY TEMPLATES ({sc-spring-boot-autoconfigure}/velocity/VelocityAutoConfiguration.{sc-ext}[VelocityAutoConfiguration])

View File

@@ -1294,7 +1294,7 @@ templates will be picked up automatically from `src/main/resources/templates`.
TIP: IntelliJ IDEA orders the classpath differently depending on how you run your
application. Running your application in the IDE via its main method will result in a
different ordering to when you run your application using Maven or Gradle or from its
pacakaged jar. This can cause Spring Boot to fail to find the templates on the classpath.
packaged jar. This can cause Spring Boot to fail to find the templates on the classpath.
If you're affected by this problem you can reorder the classpath in the IDE to place the
module's classes and resources first. Alternatively, you can configure the template prefix
to search every templates directory on the classpath: `classpath*:/templates/`.