Remove support for Velocity following its deprecation in 1.4

Closes gh-6971
This commit is contained in:
Andy Wilkinson
2016-09-29 14:05:49 +01:00
parent 464915d2cc
commit 2a035d0748
38 changed files with 15 additions and 1661 deletions

View File

@@ -407,28 +407,6 @@ content into your application; rather pick only the properties that you need.
spring.thymeleaf.template-resolver-order= # Order of the template resolver in the chain.
spring.thymeleaf.view-names= # Comma-separated list of view names that can be resolved.
# VELOCITY TEMPLATES ({sc-spring-boot-autoconfigure}/velocity/VelocityAutoConfiguration.{sc-ext}[VelocityAutoConfiguration])
spring.velocity.allow-request-override=false # Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.
spring.velocity.allow-session-override=false # Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name.
spring.velocity.cache= # Enable template caching.
spring.velocity.charset=UTF-8 # Template encoding.
spring.velocity.check-template-location=true # Check that the templates location exists.
spring.velocity.content-type=text/html # Content-Type value.
spring.velocity.date-tool-attribute= # Name of the DateTool helper object to expose in the Velocity context of the view.
spring.velocity.enabled=true # Enable MVC view resolution for this technology.
spring.velocity.expose-request-attributes=false # Set whether all request attributes should be added to the model prior to merging with the template.
spring.velocity.expose-session-attributes=false # Set whether all HttpSession attributes should be added to the model prior to merging with the template.
spring.velocity.expose-spring-macro-helpers=true # Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext".
spring.velocity.number-tool-attribute= # Name of the NumberTool helper object to expose in the Velocity context of the view.
spring.velocity.prefer-file-system-access=true # Prefer file system access for template loading. File system access enables hot detection of template changes.
spring.velocity.prefix= # Prefix that gets prepended to view names when building a URL.
spring.velocity.properties.*= # Additional velocity properties.
spring.velocity.request-context-attribute= # Name of the RequestContext attribute for all views.
spring.velocity.resource-loader-path=classpath:/templates/ # Template path.
spring.velocity.suffix=.vm # Suffix that gets appended to view names when building a URL.
spring.velocity.toolbox-config-location= # Velocity Toolbox config location. For instance `/WEB-INF/toolbox.xml`
spring.velocity.view-names= # White list of view names that can be resolved.
# SPRING WEB SERVICES ({sc-spring-boot-autoconfigure}/webservices/WebServicesProperties.{sc-ext}[WebServicesProperties])
spring.webservices.path=/services # Path that serves as the base URI for the services.
spring.webservices.servlet.init= # Servlet init parameters to pass to Spring Web Services.

View File

@@ -1417,41 +1417,11 @@ added.
suffix (externalized to `spring.groovy.template.prefix` and
`spring.groovy.template.suffix`, defaults '`classpath:/templates/`' and '`.tpl`'
respectively). It can be overridden by providing a bean of the same name.
* If you use Velocity you will also have a `VelocityViewResolver` with id '`velocityViewResolver`'.
It looks for resources in a loader path (externalized to `spring.velocity.resourceLoaderPath`,
default '`classpath:/templates/`') by surrounding the view name with a prefix and suffix
(externalized to `spring.velocity.prefix` and `spring.velocity.suffix`, with empty and '`.vm`'
defaults respectively). It can be overridden 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`],
{sc-spring-boot-autoconfigure}/freemarker/FreeMarkerAutoConfiguration.{sc-ext}[`FreeMarkerAutoConfiguration`],
{sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[`GroovyTemplateAutoConfiguration`] and
{sc-spring-boot-autoconfigure}/velocity/VelocityAutoConfiguration.{sc-ext}[`VelocityAutoConfiguration`]
[[howto-customize-view-resolvers-velocity]]
=== Velocity
By default, Spring Boot configures a `VelocityViewResolver`. If you need a
`VelocityLayoutViewResolver` instead, you can easily configure your own by creating a bean
with name `velocityViewResolver`. You can also inject the `VelocityProperties` instance to
apply the base defaults to your custom view resolver.
The following example replaces the auto-configured velocity view resolver with a
`VelocityLayoutViewResolver` defining a customized `layoutUrl` and all settings that would
have been applied from the auto-configuration:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@Bean(name = "velocityViewResolver")
public VelocityLayoutViewResolver velocityViewResolver(VelocityProperties properties) {
VelocityLayoutViewResolver resolver = new VelocityLayoutViewResolver();
properties.applyToViewResolver(resolver);
resolver.setLayoutUrl("layout/default.vm");
return resolver;
}
----
{sc-spring-boot-autoconfigure}/freemarker/FreeMarkerAutoConfiguration.{sc-ext}[`FreeMarkerAutoConfiguration`] and
{sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[`GroovyTemplateAutoConfiguration`]
@@ -2370,14 +2340,6 @@ for other Groovy customization options.
[[howto-reload-velocity-content]]
==== Velocity templates
If you are using Velocity, then set `spring.velocity.cache` to `false`. See
{sc-spring-boot-autoconfigure}/velocity/VelocityAutoConfiguration.{sc-ext}[`VelocityAutoConfiguration`]
for other Velocity customization options.
[[howto-reload-fast-restart]]
=== Fast application restarts
The `spring-boot-devtools` module includes support for automatic application restarts.

View File

@@ -1774,10 +1774,9 @@ solution for all static resources, effectively adding a content hash in URLs, su
----
NOTE: Links to resources are rewritten at runtime in template, thanks to a
`ResourceUrlEncodingFilter`, auto-configured for Thymeleaf, Velocity and FreeMarker. You
should manually declare this filter when using JSPs. Other template engines aren't
automatically supported right now, but can be with custom template macros/helpers and the
use of the
`ResourceUrlEncodingFilter`, auto-configured for Thymeleaf and FreeMarker. You should
manually declare this filter when using JSPs. Other template engines aren't automatically
supported right now, but can be with custom template macros/helpers and the use of the
{spring-javadoc}/web/servlet/resource/ResourceUrlProvider.{dc-ext}[`ResourceUrlProvider`].
When loading resources dynamically with, for example, a JavaScript module loader, renaming
@@ -1821,7 +1820,7 @@ will automatically configure Spring MVC to use it.
[[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
Spring MVC supports a variety of templating technologies including Thymeleaf, FreeMarker
and JSPs. Many other templating engines also ship their own Spring MVC integrations.
Spring Boot includes auto-configuration support for the following templating engines:
@@ -1829,7 +1828,6 @@ Spring Boot includes auto-configuration support for the following templating eng
* http://freemarker.org/docs/[FreeMarker]
* http://docs.groovy-lang.org/docs/next/html/documentation/template-engines.html#_the_markuptemplateengine[Groovy]
* http://www.thymeleaf.org[Thymeleaf]
* http://velocity.apache.org[Velocity] (deprecated in 1.4)
* http://mustache.github.io/[Mustache]
TIP: JSPs should be avoided if possible, there are several